我正在使用Webpack + NPM构建我的应用程序,并且在生产服务器上渲染Bootstrap-SASS Glyphicons时出现问题。当地的Glyphicons渲染得很好。
在 Chrome 中,我得到以下内容
Failed to decode downloaded font: http://app.azurewebsites.net/build448c34a56d699c29117adc64c43affeb.woff2
OTS parsing error: invalid version tag
Failed to decode downloaded font: http://app.azurewebsites.net/buildfa2772327f55d8198301fdb8bcfc8158.woff
OTS parsing error: invalid version tag
Failed to decode downloaded font: http://app.azurewebsites.net/builde18bbf611f2a2e43afc071aa2f4e1512.ttf
OTS parsing error: invalid version tag
以下是一些相关文件。我环顾四周但一直无法找到解决方案。如果您有任何想法,请告诉我。感谢
$icon-font-path: '~bootstrap-sass/assets/fonts/bootstrap/';
@import '~bootstrap-sass/assets/stylesheets/_bootstrap.scss';
var path = require('path');
var buildPath = "./build";
var webpack = require('webpack')
module.exports = {
entry: "./src/entry.js",
output: {
path: buildPath,
publicPath: buildPath,
filename: "bundle.js"
},
module: {
loaders: [
{test: /\.css$/, loader: 'style-loader!css'},
{test: /\.scss$/, loader: 'style-loader!css!sass'},
// { test: /.woff2?(\?v=\d+.\d+.\d+)?$/, loader: "url?limit=10000&minetype=application/font-woff" },
{test: /\.(png|jpg|svg|woff|woff2)?(\?v=\d+.\d+.\d+)?$/, loader: 'url-loader?limit=8192'},
{test: /\.(eot|ttf)$/, loader: 'file-loader'}
]
}
};
"dependencies": {
"bootstrap-sass": "^3.3.6",
"node-sass": "^3.4.2",
"file-loader": "^0.8.5",
"css-loader": "^0.21.0",
"sass-loader": "^3.1.2",
"style-loader": "^0.13.0",
"url-loader": "^0.5.7",
"webpack": "^1.12.2"
}
答案 0 :(得分:0)
找到解决方案。我通过执行以下操作为path
指定绝对网址来解决此问题:
output: {
path: path.resolve(__dirname, "build"),
publicPath: "build/",
filename: "bundle.js"
}