Answer the question
In order to leave comments, you need to log in
Why doesn't htmlWebpackPlugin process images?
I am using HTML Webpack Plugin to process html. It works and inserts styles and scripts as it should, but it does not process the src of images.
That is, it leaves the path and filename, and when webpack builds, it changes the filenames.
my config
module.exports = {
entry: './src/scripts/index.js',
output: {
filename: 'main.js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
// imgaes
{
test: /\.(png|svg|jpg|gif)$/,
use: [
'file-loader',
]
},
]
},
plugins: [
//обработка html страниц
...glob.sync('src/html/*.html')
.map(html => new HtmlWebpackPlugin({
filename: path.basename(html),
template: html
})),
]
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question