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

Commit

Permalink
fix(index): allow to override publicPath with an empty string (#145)
Browse files Browse the repository at this point in the history
  • Loading branch information
dms1lva authored and michael-ciniawsky committed Apr 15, 2017
1 parent 9afc205 commit 26ab81a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
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

0 comments on commit 26ab81a

Please sign in to comment.