Answer the question
In order to leave comments, you need to log in
Webpack url fix plugin?
Hello everyone ! I would be grateful if you can help in solving such a problem:
0) We have the following file structure:
+ dist/
--- loadable/
--- bundle.css
--- bundle.js
+ src
--- loadable/
...
font-face {
font-family: Font1;
src: url('../../loadable/fonts/52452.otf');
}
{
test: /\.(sass|scss)$/,
include: path.resolve(__dirname, 'src'),
use: ExtractTextPlugin.extract({
use: [{
loader: "css-loader",
options: {
sourceMap: true,
minimize: true,
url: false
}
}, {
loader: "sass-loader",
options: {
sourceMap: true
}
}]
})
}
font-face {
font-family: Font1;
src: url('../../loadable/fonts/52452.otf');
}
font-face {
font-family: Font1;
src: url('loadable/fonts/52452.otf');
}
Answer the question
In order to leave comments, you need to log in
Your css-loader options are set url: false
to , so it doesn't process constructs url('../*/font.otf')
in styles and leaves them as they are. Uncheck this option, then css-loader will try to resolve the specified resources as if you imported them from JS. Most likely Webpack will complain because it doesn't know how to handle these types of files; so as not to swear, specify in the config file-loader or url-loader for fonts and other locally connected files.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question