This appears to be such a common problem, but the other questions I've seen don't have the symptoms I do.
I am using the font-awesome
npm package with React, Scss and Webpack. (I tried font-awesome-webpack
and some others but they didn't work for me.) I'm not using Bootstrap.
I followed the directions of many questions in SO, tutorials, etc, but the same thing seems to happen. Either an error, or I get symbols on the page where the icons should be (e.g. I get ~
instead of a download icon)
In my react view: <span className="fa fa-download"/>
(it's rendered as ~
)
Top two lines of my main.sass
:
$fa-font-path: "~font-awesome/fonts"
@import "~font-awesome/scss/font-awesome.scss"
In webpack.config.js
(I've tried lots of permutations of the following with no success):
{ test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "url-loader?limit=10000&mimetype=application/font-woff" },
{ test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }
In package.json
, I have font-awesome
installed in the dependency list, as well as file-loader
, css-loader
, style-loader
, sass-loader
, and url-loader
in devDependencies.
The font on the rendered HTML element in question shows font-family: FontAwesome
. There are no 404s or other issues in the console.
Can someone tell me what I'm doing wrong?