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

CSDN Q & A 2022-01-15 02:32:50

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


thank
Similar articles

2022-01-15

2022-01-15

2022-01-15

2022-01-15