I'm trying to include font awesome in my reactjs application and these are the steps i followed.
1. npm install --save font-awesome
2. Import it to my jsx file
import '../../../../../../node_modules/font-awesome/css/font-awesome.min.css';
3. Adding url-loader to my webpack.config.js
{
test: /\.(woff|woff2|eot|ttf)(\?.*$|$)/,
loader: 'url-loader?limit=100000'
}
But i'm getting this issue.How can i fix this?
../~/font-awesome/css/font-awesome.min.css Module parse failed: C:\Users\admin\Documents\revegator-platform\node_modules\font-awesome\css\font-awesome.min.css Unexpected character '@' (4:3) You may need an appropriate loader to handle this file type.
My webpack.config.js
'use strict';
let path = require('path');
module.exports = {
entry: path.resolve('./src/main.js'),
output: {
path: path.resolve('../public/js'),
filename: 'build.js'
},
resolve: {
extensions: ['.js', '.jsx', '.json']
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.s[a|c]ss$/,
loader: 'style-loader!css-loader!sass-loader'
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
}
};