-
Notifications
You must be signed in to change notification settings - Fork 513
publicPath parameter doesn't work? #246
Comments
I'm running into this same issue. |
Think you should set the overriding
See: #212 |
Tried numerous configurations, none of which work. At this point, i am reasonably confident it doesn't do anything. |
I've played with the config and tens of combinations for hours without even a hint of it doing anything. Any work arounds? |
I ended up using a |
Here's some code in case it's helpful: textTransformLoader: {
fixPaths: {
transformText: function(content) {
// Internal production builds (gh-pages for internal repo) require a
// path prefix for all urls.
if (flags.production && flags.internal) {
content = content.replace(/(url\(\\?['"])(\/.+?\))/g, '$1/' + config.internalPathPrefix + '$2');
}
return content;
},
},
}, |
@heylookltsme i have met the same problem, could you expain how you config textTransformLoader? |
Ah, sure thing. Yeah, there's a missing puzzle piece here. I'm using it with the ExtractTextPlugin. So the relevant portions of the config look like this: module: {
loaders: [
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract(
flags.production ? 'style' : 'style?sourceMap',
flags.production ?
'text-transform?pack=fixPaths!css!postcss!sass' :
'text-transform?pack=fixPaths!css?sourceMap!postcss!sass?sourceMap'
),
},
],
},
textTransformLoader: {
fixPaths: {
transformText: function(content) {
// Internal production builds (gh-pages for internal repo) require a
// path prefix for all urls.
if (flags.production && flags.internal) {
content = content.replace(/(url\(\\?['"])(\/.+?\))/g, '$1/' + config.internalPathPrefix + '$2');
}
return content;
},
},
},
plugins: [
new ExtractTextPlugin('index.css', {
allChunks: true,
}),
], Notice the I hope that's helpful! Let me know if you're still having trouble. |
@heylookltsme thank you very much and it works perfect~~~ |
@heylookltsme thank you very much, I have solve the problem by redefine publicPath for file-loader, as below config:
PS: Maybe this bug has been fixed by the PR #305 |
Can you confirm this against webpack 2? |
@bebraw I haven't use webpack 2, the config is for webpack 1.14. |
Ok. Note that you can set If you can confirm it's broken with webpack 2, please re-open. |
my config that worked looks like this:
|
Solved similar problem just by disabling of
Before I had issue during SCSS compilation when writing |
I'm having a similar problem to the one that originally started this thread. Here's my folder structure:
What I'd like to happen is that all calls inside of
Instead, by default, I'm seeing:
... which then means the browser is looking for The obvious answer is just to set The closest I've been able to get to solving it is setting to
... and works well. But - those unnecessary The
Does anyone know of either: a) A way to have Extract Text Plugin compare the current output path with the or (probably more likely): b) Get Any pointers would be appreciated. And sorry for digging up a closed/old issue! |
When I use extract-text-webpack-plugin output css file into a folder, the image url is wrong, my webpack config is below:
my output 'build' folder tree like this:
But in my output css file the image url is 'images/arrow.png', what I want is like '../images/arrow.png'.
Then I add the extract-text-webpack-plugin options like below:
Change:
To:
But the parameter 'publicPath' doesn't work, in my output css file the image url is still 'images/arrow.png'.
My package.json is like bellow:
The text was updated successfully, but these errors were encountered: