react-fonticonpicker
react-fonticonpicker copied to clipboard
Webpack help
Could support for configuring webpack to work with fonticonpicker please be added? It is almost impossible to use this in a React app that has more going on. I have tried using every loader in webpack and seeking help, but keep getting a new error every time because it is importing css which also includes @font-face into React components..
This is the webpack that I am working with https://codepen.io/anon/pen/romzbj
Can you expand on what the error is? I was able to get it working using require instead of import. Maybe not the best solution but it works.
require("@fonticonpicker/react-fonticonpicker/dist/fonticonpicker.base-theme.react.css"); require("@fonticonpicker/react-fonticonpicker/dist/fonticonpicker.material-theme.react.css");
You basically need file-loader
to handle the font files.
{
test: /\.(woff|woff2|eot|ttf|otf|png|jpg|gif)(\?v=\d+\.\d+\.\d+)?$/,
use: [
{
// With file loader which copies file
// and brings in URL to the file
loader: 'file-loader',
options: {
name: '[name]-[hash:6].[ext]',
outputPath: 'assets/',
},
},
],
},
In your webpack module.rules
.