Closed cichy380 closed 5 years ago
If webpack finds the assets without error then it is working correctly.
The css loader will identify assets. But The actual output path for assets is based on the loader for the asset files. Which is not shown.
Presuming you are using file loader or similar then there should be output options there.
Webpack will rewrite all the URL in the css loader as required.
Yes, webpack finds the assets and /dist folder structure looks good:
- /dist
|- index.html
|- /fonts
|- FontName.eot
|- /css
|- styles.css
...
but I need to correct URL in output CSS files: http://localhost/fonts/FontName.woff
How can I configure it? Maybe in resolve-url-loader options?
PS Output CSS filename is defined in plugins of webpack.config.js:
...
plugins: [
new MiniCssExtractPlugin({
filename: './css/styles.css'
}),
...
]
...
output.publicPath: “/“
That will give you root relative URL to assets.
To be clear, nothing in the css loader chain can effect the asset output path when webpack is aware of the assets.
So resolve-url-loader is not helping in that respect.
Works! Thanks for help
I try to resolve problem with loading font files.
Part of my project files structure:
main.scss
_fonts.scss
webpack.config.js
I expect in output CSS file:
...but I got:
and browser looks for font file in: http://localhost/css/fonts/FontName.woff