cannot load png files with webpack, unexpected character

后端 未结 4 905
梦谈多话
梦谈多话 2021-02-02 07:25

Im trying to reconfigure my webpack, and now i cannot load the css files. i keep my styles in src > styles > main.css

I am getting errors such as

ERROR          


        
4条回答
  •  隐瞒了意图╮
    2021-02-02 08:05

    Just an update, I got warnings using this setup for webpack.config.js

    So to solve the warnings I have to change to this:

    {
            test: /\.(jpe?g|png|gif|svg)$/i,
            use: [
              {
                loader: 'file-loader',
                options: {
                  query: {
                    name:'assets/[name].[ext]'
                  }
                }
              },
              {
                loader: 'image-webpack-loader',
                options: {
                  query: {
                    mozjpeg: {
                      progressive: true,
                    },
                    gifsicle: {
                      interlaced: true,
                    },
                    optipng: {
                      optimizationLevel: 7,
                    }
                  }
                }
              }]
          }
    

提交回复
热议问题