2
在反應項目中使用bootstrap時,運行dev環境可以正常工作。但是當我運行npm build package項目。顯示引導字體錯誤。如何配置webpack在React中加載glyphicons/font-awesome圖標
ERROR in ./~/bootstrap/dist/fonts/glyphicons-halflings-regular.eot
Module parse failed: /Users/xx/WorkDir/react-leap/node_modules/bootstrap/dist/fonts/glyphicons-halflings-regular.eot Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '�' (1:0)
at Parser.pp.raise (/Users/xx/WorkDir/react-leap/node_modules/webpack/node_modules/acorn/dist/acorn.js:923:13)
at Parser.pp.getTokenFromCode (/Users/xx/WorkDir/react-leap/node_modules/webpack/node_modules/acorn/dist/acorn.js:2831:8)
我的WebPack配置
module: {
loaders: [
{
test: /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
loader: 'file-loader',
include: paths
}
]
}
引導版本:
"bootstrap": "3.3.6",
完美的作品。這個答案應該被接受。 – theTechRebel