Skip to content
This repository has been archived by the owner on Mar 17, 2021. It is now read-only.

fix: allow to override publicPath with an empty string #145

Merged
merged 4 commits into from
Apr 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ module.exports = function(content) {
}

var publicPath = "__webpack_public_path__ + " + JSON.stringify(url);
if (config.publicPath) {
if (config.publicPath !== false) {
// support functions as publicPath to generate them dynamically
publicPath = JSON.stringify(
typeof config.publicPath === "function"
Expand Down
12 changes: 12 additions & 0 deletions test/correct-filename.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ describe("publicPath option", function() {
'module.exports = "http://cdn/81dc9bdb52d04dc20036dbd8313ed055.txt";'
);
});

it("should override public path when given empty string", function() {
run("file.txt", "publicPath=").result.should.be.eql(
'module.exports = "81dc9bdb52d04dc20036dbd8313ed055.txt";'
);
});

it("should use webpack public path when not set", function() {
run("file.txt").result.should.be.eql(
'module.exports = __webpack_public_path__ + "81dc9bdb52d04dc20036dbd8313ed055.txt";'
);
});
});

describe("useRelativePath option", function() {
Expand Down