-
Notifications
You must be signed in to change notification settings - Fork 75
Feature: add publicPath query option #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jhnns
merged 3 commits into
peerigon:master
from
jpommerening:feature-add-publicPath-option
Nov 25, 2016
Merged
Feature: add publicPath query option #12
jhnns
merged 3 commits into
peerigon:master
from
jpommerening:feature-add-publicPath-option
Nov 25, 2016
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ping @jhnns :) |
That's a great change! 👍 Could you add that option to the README (under options :))? |
1 similar comment
Awesome, thx. Shipped as |
Thanks! 🎉 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
First: Thanks for releasing this wonderful loader! This pull request allows for the
publicPath
to be set via query parameter.Let me try to explain why I need this.
My project's directory structure looks like this:
I'm using a relative
publicPath
in my webpack config, so that the bundledmain.js
and extracted CSS don't depend on the path where I deploy my project:I've set up my
file-loader
to put files into theassets
subdirectory inside the output path:Bundling and hot reload (sometimes finicky to get right in conjunction with
publicPath
) both work as expected with this setup.However, issues arise when the extracted and
file-loader
'ed CSS file has references to other files, images for example. Because of my relativepublicPath
theextract-loader
generates a CSS file that containsurl(dist/assets/f001ce-img.png)
just like you would expect. But since thefile-loader
puts the extracted CSS into a file that is already in that same directory, that URL now point atdist/assets/dist/assets/f001ce-img.png
. (Note: the problem would even arise if I'd omit the sub directory in my file loader config.)To alleviate that issue I want to be able to set the public path manually when extracting and passing the output to the
file-loader
. In my case, I'd just add?publicPath=../
to theextract-loader
to step back up intodist/
fromdist/assets/
.Maybe I'm taking things too far with my setup, but the change is pretty minor and backwards compatible. Also, the loader-wrapper-thing in
extract-text-webpack-plugin
has the same option. :)