javascript - webpack using font awesome -
in react app want use fontawesome css files webpack , css loaders. configuration looks this:
webpack config
module: { rules: [ { test: /\.js?$/, loader: 'babel-loader', options: { presets: [ ["es2015", { modules: false }], "stage-2", "react" ], plugins: [ "transform-node-env-inline" ], env: { development: { plugins: ["react-hot-loader/babel"] } } } }, { test: /\.(eot|ttf|woff2?|otf|svg|png|jpg)$/, loaders: ['file'] }, { test: /\.css$/, use: [ "style-loader", { loader: "css-loader", options: { modules: true, sourcemap: true, importloaders: 1, localidentname: "[name]--[local]--[hash:base64:8]" } }, "postcss-loader" // has separate config, see postcss.config.js nearby ] }, ]
in index.js have this:
import 'font-awesome/css/font-awesome.css';
and in render method have this:
<li><navlink to="/dashboard" classname="fa fa-bars" activeclassname="activesidebar" aria-hidden="true"></navlink></li>
there noe errors, no icons displayed ... whats mistake?
thanks
you may need add name argument loader handles font files.
eg:
... { test: /\.(eot|ttf|woff2?|otf|svg|png|jpg)$/, loader: 'file-loader?name=./[name].[hash].[ext]' }, ...
Comments
Post a Comment