以.svg为例
const path = require('path');
module.exports = {
mode: 'development',
entry: {
main: './src/index.js'
},
//当满足对应的rules时,应用对应的loader
module: {
rules: [{
test: /\.(eot|ttf|svg)$/,
use: {
loader: 'file-loader'
}
}]
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist')
}
}
字体loader
-
file-loader: 将图标字体打包