将图片打包到专门存放图片的 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',
          },
        },
      },
    ],
  },
}

posted on 2021-09-10 10:13  aisowe  阅读(70)  评论(0编辑  收藏  举报

导航