Answer the question
In order to leave comments, you need to log in
Webpack url loader how to handle images always?
There is an assembly with a customized loader.
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'url',
query: {
limit: 1000,
name: '[name].[ext]?[hash:7]'
}
Answer the question
In order to leave comments, you need to log in
always - no way, that's the point: if the image is not used in the code (there is not a single require('path/to/image') call), then it will not get into the bundle. Adding a request to an image will put it in the bundle accordingly. Simple as that.
Why is there a picture that is never needed in the current code - a separate question of course :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question