webpack 将不同类型的文件输出到不同文件夹

参考: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'
  },
posted @ 2017-06-09 00:26  LisPythoniC  阅读(821)  评论(0编辑  收藏  举报