webpack 3加载图像文件加载器失败

时间:2019-05-22 14:46:35

标签: reactjs webpack

我无法在我的React应用中显示图片, 在网络中,我看到浏览器尝试加载名为 38c8e649d3c22c3ef136af6e800bfb58.PNG 原名不一样

我使用文件加载器

这是我的webpack.config

var path = require('path');
var webpack = require('webpack');


module.exports = {
    node: { fs: "empty" },

    entry: 
         './Scripts/SampleModule/app.jsx'
    ,
    devtool: 'eval',
    output: {
        filename: 'bundle.js' ,
        path: path.resolve('Scripts/build') //path.resolve('dist') 
    },
    module: {
        rules: [
            {
                test: /\.css$/,
                use: [
                    { loader: "style-loader" },
                    { loader: "css-loader" }
                ]
            },
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: "babel-loader"
            },
            {
                test: /\.jsx?$/,
                exclude: /node_modules/,
                use: "babel-loader"
            }
            ,
            {
                test: /\.(gif|png|jpe?g|svg)$/i,
                use: [
                    'file-loader'
                ],
            }

        ]   
    },
    watch: true
};

要使其正常运行,我需要在Webpack中进行哪些更改?

0 个答案:

没有答案