Answer the question
In order to leave comments, you need to log in
Why is webpack not finding the image?
Good day.
There is webpack.config.js and it contains rules for loading images
const path = require('path');
const htmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: {
app: path.join(__dirname, '..', 'src')
},
output: {
filename: '[name].js',
path: path.join(__dirname, '..', 'dist')
},
plugins:[
new htmlWebpackPlugin({
title: 'Webpack demo',
filename: 'index.html'
})
],
module: {
rules: [
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
options: {
limit: 10000,
name: path.join('static', 'img/[name].[ext]')
}
}
]
}
};
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