Webpack failing at @font-face

二次信任 提交于 2019-12-08 18:46:32

问题


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' }
    ],
}

And here is the error I am receiving:

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.


回答1:


Silly error. Removed the exclude from my css loader and got it working.

{ test: /(\.css$)/, loaders: ['style-loader', 'css-loader', 'postcss-loader'] }


来源:https://stackoverflow.com/questions/33399627/webpack-failing-at-font-face

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!