vue使用element-ui字体文件不显示,显示效果为方框javascript
警告信息css
Failed to decode downloaded font: http://192.168.43.169:8092/static/css/static/fonts/element-icons.535877f.woff OTS parsing error: invalid version tag
本地环境没问题,打包以后就会出现问题。锁定问题应该是配置文件的问题。查看配置文件:html
//dev: assetsPublicPath: '/', //build: assetsPublicPath: './',
src: url('../fonts/sell-icon.eot?u0tu7l')
src: url('../fonts/sell-icon.eot?u0tu7l#iefix') format('embedded-opentype'),
url('../fonts/sell-icon.ttf?u0tu7l') format('truetype'),
url('../fonts/sell-icon.woff?u0tu7l') format('woff'),
url('../fonts/sell-icon.svg?u0tu7l#sell-icon') format('svg')vue
index: path.resolve(__dirname, '../dist/index.html'), assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: 'static', assetsPublicPath: './',
index: path.resolve(__dirname, '../dist/index.html'),// Paths assetsRoot: path.resolve(__dirname, '../dist'), assetsSubDirectory: './assets/', assetsPublicPath: './hello/', 打包后为 <script type="text/javascript" src="./hello/assets/js/manifest.js"></script> <script type="text/javascript" src="./hello/assets/js/vendor.js"></script> <script type="text/javascript" src="./hello/assets/js/app.js"></script>
assetsRoot : 在当前目录的上一级 的 dist目录下输出资源文件 assetsSubDirectory: 把全部的静态资源打包到 dist下的 assets文件夹下 assetsPublicPath :表明生成的index.html文件,里面引入资源时,路径前面要加上 ./hello/,也就是assetsPublicPath的值