L
L
lavezzi12016-06-27 08:28:38
JavaScript
lavezzi1, 2016-06-27 08:28:38

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]'
            }

Now it works like this - if the picture is used in templates, then the picture gets into the assembly, if not, then, accordingly, it is not in the assembly. How can I make sure that it always gets into the assembly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman, 2016-06-27
@lavezzi1

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 question

Ask a Question

731 491 924 answers to any question