今天vue-cli打包完发现加载不出font awesome;路经和奇怪,js,css,img都正确加载;

首先正确加载静态资源需要将config中的index.js中publicPath:'./';

而font awesome的坑再于webpack对文件打包大小有限制(此处怪我没有好好学webpack);

而我发现我的font文件打包后竟有400k!!!!!

需要修改webpack.bace.conf.js中代码

{
    test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
    oader: 'url-loader',
    options: {
    limit: 800000,
    name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
}

bingo!!!

相关文章:

  • 2022-01-13
  • 2022-12-23
  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-05
  • 2022-02-08
  • 2021-06-18
  • 2022-12-23
相关资源
相似解决方案