原本項(xiàng)目執(zhí)行構(gòu)建命令,字體包能正確輸出到指定位置燃辖,但是隨著打包的文件增加鬼店,發(fā)現(xiàn) dist/fonts
文件夾內(nèi)字體包丟失了
使用 vue inspect
檢查配置,結(jié)果:
/* config.module.rule('fonts') */
{
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/i,
use: [
{
loader: 'D:\\**\\node_modules\\url-loader\\dist\\cjs.js',
options: {
limit: 4096,
fallback: {
loader: 'D:\\**\\node_modules\\file-loader\\dist\\cjs.js',
options: {
name: 'fonts/[name].[hash:8].[ext]'
}
}
}
}
]
},
猜測是 limit
過小導(dǎo)致的黔龟,在 vue.config.js
修改配置
config.module
.rule('fonts')
.use('url-loader')
.loader('url-loader')
.tap(options => {
options.limit = 10000
return options
})
執(zhí)行構(gòu)建妇智,字體包正確輸出~