Webpack loader url how to process images?

There is a Assembly with a configured loader.

 test: /\.(png|jpg|gif|svg)$/,
 loader: 'url',
 query: {
 limit: 1000,
 name: '[name].[ext]?[hash:7]'

Now works well if the image used in templates, the image enters the Assembly, if not then respectively, and in the Assembly there. How to make it so that she was in the Assembly?
July 8th 19 at 11:21
1 answer
July 8th 19 at 11:23
always all, in this sense: if the picture is not used in the code (there is no call to require('path/to/image') )then bundle it will not fall. Adding a request for a picture accordingly will put it in the bundle. Simple as that.
Why there is a picture in which the actual code does not need never - a separate issue of course :)
In json you need to specify the image, but using json it is not requireda. - pauline.Herman commented on July 8th 19 at 11:26
Because json is not executable code. Need to call require() or url() in css. Import from in es6 too. - Pink.Kuhn commented on July 8th 19 at 11:29

Find more questions by tags JavaScriptWebpack