首页 > 其他 > 详细

浏览器警告Failed to decode downloaded font 系统页面字体图标加载不出来 问题总结

时间:2021-05-07 10:26:27      阅读:27      评论:0      收藏:0      [点我收藏+]

1.后台拦截,此时警告后往往是localhost:8080一类的地址

  解决方法:maven放行,或者springSecurity放行

maven放行:在pom文件中(网上抄来的)

<resources>
    <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <excludes>
             <exclude>static/**/*.woff</exclude>
             <exclude>static/**/*.woff2</exclude>
             <exclude>static/**/*.ttf</exclude>
        </excludes>
     </resource>
     <resource>
         <directory>src/main/resources</directory>
         <filtering>false</filtering>
         <includes>
              <include>static/**/*.woff</include>
              <include>static/**/*.woff2</include>
              <include>static/**/*.ttf</include>
         </includes>
     </resource>

 

2. 前端问题 ,此时警告后往往跟的是url类型的,如application.....

可能是打包问题,我自己是跟着B站一个教程做的Vue+SpringBoot+ElementUI的系统

在vue项目中的webpack.base.conf.js中的module里,将原有的url-loader注释掉,用file-loader解析这些字体文件即可

//注释的原代码(url-loader)
/*{
        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
        loader: ‘url-loader‘,
        options: {
          limit: 10000,
          name: utils.assetsPath(‘fonts/[name].[hash:7].[ext]‘)
        }
      },*/
//用file-loader 
      {
        //是为了解析字体的模块,遇到“eot|svg|ttf|woff|woff2”,用file-loader模块解析,正则表达式
        test: /\.(eot|svg|ttf|woff|woff2)$/,
        loader: file-loader
      }

 

浏览器警告Failed to decode downloaded font 系统页面字体图标加载不出来 问题总结

原文:https://www.cnblogs.com/tongsuh/p/14737535.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!