Answer the question
In order to leave comments, you need to log in
How to load unused images in webpack?
Recently started using Webpack. Now I'm making a front for a Django project using Django Templates, etc. There is a problem with Webpack - I use the following rule to transfer images:
{
test: /\.(jpg|png|svg)$/,
loader: 'file-loader',
options: {
name: 'img/[name].[ext]'
}
}
Answer the question
In order to leave comments, you need to log in
Use Copy webpack plugin
const CopyWebpackPlugin = require('copy-webpack-plugin');
...
plugins: [
new CopyWebpackPlugin([
{ from: './src/img/', to: './img/' }
],
{
debug: true,
ignore: [ '*.js', '*.css', '*.scss' ]
}),
...
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question