I am trying to rewrite my resource paths from a specific path ( ~assets/myimage.png
) to the correct directory (in my case /assets/
).
I told my webpack to write all the images in a folder inside the public. Images are spelled correctly, however the css assembly url is not adjusted accordingly.
This is the rule that I use for my stylus files.
use: ExtractTextPlugin.extract({
fallback: {
loader: require.resolve("style-loader"),
options: {
hmr: false
}
},
use: [
{
loader: require.resolve("css-loader")
},
{
loader: require.resolve("stylus-loader")
}
]
})
and the one that I use for assets
{
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
loader: require.resolve("url-loader"),
options: {
limit: 100,
name: "static/media/[name].[hash:8].[ext]"
}
},
My alias that resolves the correct directory is:
assets: path.resolve(__dirname, "../public")
and the public path is set as /assets/
publicPath: publicPath + "assets/",
Since I am using ExtractTextPlugin, the style loader cannot be used. When using the style loader only it works, however in my use case I need a css file like/style.css
Any ideas on this?