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的值