参考:https://*.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'
},