webpack打包图标文件主要是用到了file-loader,相关配置如下
const path = require('path') const htmlWebpackPlugin = require('html-webpack-plugin') module.exports = { entry: "./src/main.js", output:{ filename: 'index.js', path:path.resolve(__dirname, 'build') }, module:{ rules:[ { test: /.css$/, use:[ "style-loader", "css-loader" ] }, { test: /.(eot|ttf|svg|woff)$/, loader:"file-loader", options: { outputPath: 'font/' //指定这些文件打包后的目录 } } ] }, plugins:[ new htmlWebpackPlugin({ template:"./src/index.html" }) ], mode:'development' }