I
I
Igor Myasnikov2017-08-31 19:00:33
JavaScript
Igor Myasnikov, 2017-08-31 19:00:33

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

But 'staticimgmu.png' is substituted in the URL and searches along the path webpack/dist/css/staticimgmu.png
And why does it also substitute css in the path?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question