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

Commit 26ab81a

Browse files
dms1lvamichael-ciniawsky
authored andcommittedApr 15, 2017
fix(index): allow to override publicPath with an empty string (#145)
1 parent 9afc205 commit 26ab81a

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed
 

‎index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module.exports = function(content) {
6161
}
6262

6363
var publicPath = "__webpack_public_path__ + " + JSON.stringify(url);
64-
if (config.publicPath) {
64+
if (config.publicPath !== false) {
6565
// support functions as publicPath to generate them dynamically
6666
publicPath = JSON.stringify(
6767
typeof config.publicPath === "function"

‎test/correct-filename.test.js

+12
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,18 @@ describe("publicPath option", function() {
9292
'module.exports = "http://cdn/81dc9bdb52d04dc20036dbd8313ed055.txt";'
9393
);
9494
});
95+
96+
it("should override public path when given empty string", function() {
97+
run("file.txt", "publicPath=").result.should.be.eql(
98+
'module.exports = "81dc9bdb52d04dc20036dbd8313ed055.txt";'
99+
);
100+
});
101+
102+
it("should use webpack public path when not set", function() {
103+
run("file.txt").result.should.be.eql(
104+
'module.exports = __webpack_public_path__ + "81dc9bdb52d04dc20036dbd8313ed055.txt";'
105+
);
106+
});
95107
});
96108

97109
describe("useRelativePath option", function() {

0 commit comments

Comments
 (0)
This repository has been archived.