将图片打包到专门存放图片的 images 目录下
webpack.config.js
const { resolve } = require('path')
module.exports = {
module: {
rules: [
{
test: /\.png$/,
use: {
loader: 'file-loader',
options: {
name: '[name]-[hash].[ext]',
outputPath: 'images',
},
},
},
],
},
}