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

Conversation

dms1lva
Copy link
Contributor

@dms1lva dms1lva commented Apr 5, 2017

What kind of change does this PR introduce?

Bugfix.
Did you add tests for your changes?
Yes.

Summary
When checking if the publicPath option was set, it would only do a falsy check which would return false with an empty string. Modified it to also set the public path if an empty string is given.

Does this PR introduce a breaking change?

No.
Other information

@jsf-clabot
Copy link

jsf-clabot commented Apr 5, 2017

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dms1lva Thx in advance 😛

index.js Outdated
@@ -61,7 +61,7 @@ module.exports = function(content) {
}

var publicPath = "__webpack_public_path__ + " + JSON.stringify(url);
if (config.publicPath) {
if (config.publicPath || config.publicPath === "") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dms1lva Could you try with if (config.publicPath !== false) like it's done in #122, I would favour this PR since it contains proper testing, but the fix in #122 is cleaner :)

@michael-ciniawsky michael-ciniawsky changed the title Allow to override wepback public path with an empty string fix: allow to override publicPath with an empty string Apr 15, 2017
@dms1lva
Copy link
Contributor Author

dms1lva commented Apr 15, 2017

Made the change. My pleasure! :)

Copy link
Member

@michael-ciniawsky michael-ciniawsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dms1lva Thx

@michael-ciniawsky michael-ciniawsky merged commit 26ab81a into webpack-contrib:master Apr 15, 2017
@rtsao
Copy link

rtsao commented Apr 25, 2017

The webpack config validator does not allow publicPath: false. undefined is allowed, but not false. This change thus makes it impossible to cause __webpack_public_path__ to be used.

@bebraw
Copy link
Contributor

bebraw commented Apr 26, 2017

@rtsao Can you open an issue so we don't lose the info and get it fixed? Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants