Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-create-app using font-awesome

I'm using create-react-app and I'm trying to integrate font-awesome so I can use it in my SPA.

I've done npm install font-awesome and it's installed, but when I try to call import 'font-awesome/css/font-awesome.css' I get the following error:

Compiling...
Failed to compile.

Error in ./~/font-awesome/css/font-awesome.css
Module parse failed: C:\Projects\myproject\ui\node_modules\font-awesome\css\font-awesome.css Unexpected character '@' (7:0)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected character '@' (7:0)
 @ ./src/index.js 11:0-44
like image 536
whoisearth Avatar asked Aug 06 '16 20:08

whoisearth


1 Answers

This is webpack related...

Webpack needs to use loader to read and parse different import statements...

CSS loader https://github.com/webpack-contrib/css-loader

like image 140
Mario Nikolaus Avatar answered Nov 09 '22 05:11

Mario Nikolaus