Resource files are not generated in webpack,devServer memory so that resources cannot be accessed

webpack,devServer does not generate resource files in memory so that resources cannot be accessed

publicPath is configured as the root path, but devServer does not generate stripped resource files in memory, resulting in lack of access to picture and font resources

the files generated by local packaging separate the picture and font resources to the assets directory

devServerdevServerassetsdevServer:
devServerassets


clipboard.png I have a similar problem. The original configuration here is
name:'/ img/ [name]. [ext]', just change it to name: 'img/ [name]. [ext]'. Hope to help you


this depends on how your webpack-dev-server is configured. Refer to webpack template configuration in vue-cli2 . General


let path = require('path');
module.exports = {
  optimization:{
    splitChunks:{
      cacheGroups:{
        common:{
          chunks:'all',
          minChunks:2,
          minSize:0,
        },
      }
    }
  },
  devServer:{
    port:3000,
    progress:true,
    contentBase:'./dist',
    compress:true,
  },
  mode:'development',
  entry:{
    app:'./src/index.js',
    vendors:'./src/vendors.js',
  },
  output:{
    filename:'[name].js',
    path:path.resolve(__dirname,'dist'),
  },
  module:{
    rules:[{
      test:/\.(png|jpg|gif)$/,
      use:[ {loader:'file-loader',
            options:{
              name:'img/[name].[ext]'
            }}],
      
    }]
  }
}

there is no such problem

Menu