Webpack在@ font-face失败 [英] Webpack failing at @font-face
本文介绍了Webpack在@ font-face失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在将Webpack与FontAwesome一起使用时遇到问题.这是我的装载机:
I am having an issue using Webpack with FontAwesome. Here are my loaders:
module: {
loaders: [
{ test: /(\.js$)|(\.jsx$)/, exclude: /node_modules/, loader: 'babel-loader' },
{ test: /(\.jade$)/, exclude: /node_modules/, loader: 'jade-loader' },
{ test: /(\.css$)/, exclude: /node_modules/, loaders: ['style-loader', 'css-loader', 'postcss-loader'] },
{ test: /(\.styl$)/, exclude: /node_modules/, loaders: ['style-loader', 'css-loader', 'stylus-loader'] },
{ test: /\.(jpe|jpg|woff|woff2|eot|ttf|svg)(\?.*$|$)/, exclude: /node_modules/, loader: 'url-loader?importLoaders=1&limit=100000' },
{ test: /\.jsx$/, exclude: /node_modules/, loader: 'react-hot-loader' }
],
}
这是我收到的错误:
ERROR in ./~/font-awesome/css/font-awesome.css
Module parse failed: /Users/Username/Documents/Project/sub-project/node_modules/font-awesome/css/font-awesome.css Line 7: Unexpected token ILLEGAL
You may need an appropriate loader to handle this file type.
| /* FONT PATH
| * -------------------------- */
| @font-face {
| font-family: 'FontAwesome';
| src: url('../fonts/fontawesome-webfont.eot?v=4.4.0');
@ ./client/app.js 83:0-60
是否还有其他人遇到此问题并找到了解决方案?任何建议将不胜感激.谢谢.
Has anyone else experienced this issue and found a solution? Any suggestions would be greatly appreciated. Thanks.
推荐答案
Silly错误.从我的css加载器中删除了排除对象,并使其正常工作.
Silly error. Removed the exclude from my css loader and got it working.
{ test: /(\.css$)/, loaders: ['style-loader', 'css-loader', 'postcss-loader'] }
这篇关于Webpack在@ font-face失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文