参考:https://stackoverflow.com/questions/33058964/configure-webpack-to-output-images-fonts-in-a-separate-subfolders

  module: {
    rules: [
      { 
        test: /\.less$/, 
        use: extractLESS.extract(["css-loader","less-loader"]),
      }, 
      {
        test: /\.(png|jpg|gif|jpeg)$/,
        loader: 'file-loader',
        options: {
          name: 'image/[name].[ext]?[hash]'
        }
      },
      {
        test: /\.(svg|woff|woff2|ttf|eot)$/,
        loader: 'file-loader',
        options: {
          name: 'font/[name].[ext]?[hash]'
        }
      },
    ]
  },
  output: {
    path: path.resolve('./dist'),
    publicPath: '/',
    filename: 'js/[name].[chunkhash].js'
  },

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-27
  • 2021-07-15
  • 2022-03-08
  • 2021-10-25
  • 2021-06-06
猜你喜欢
  • 2021-11-27
  • 2021-11-27
  • 2021-10-17
  • 2022-12-23
  • 2021-11-27
  • 2022-12-23
相关资源
相似解决方案