编程知识 cdmana.com

The webpack runs successfully after it is packaged, but the CSS background picture of the browser cannot be loaded. Error 404

stay vscode Use in webpack Browser after packaging and running css Background image cannot be displayed
This is a webpack.config.js File configuration content :

const path = require('path')module.exports = {    // entrance     entry:'.c/main.js',    output:{              publicPath:'./',        path:path.resolve(__dirname,'dist'),        filename:'bundle.js'            },        module: {          rules: [            {              test: /\.css$/,                                        use: ['style-loader',  'css-loader' ]            },            {              test: /\.less$/,              use: [{                  loader: "style-loader" // creates style nodes from JS strings              }, {                  loader: "css-loader" // translates CSS into CommonJS              }, {                  loader: "less-loader" // compiles Less to CSS              }]          },          {            test: /\.(png|jpg|gif|jpeg)$/,            use: [              {                loader: 'url-loader',                options: {                  limit: 20000                }              }            ]          }          ]        }      }

This is a css The contents of the document :

img

This is a browser console error :

img

版权声明
本文为[CSDN Q & A]所创,转载请带上原文链接,感谢
https://cdmana.com/2021/12/20211207173124911a.html

Scroll to Top