react-fonticonpicker icon indicating copy to clipboard operation
react-fonticonpicker copied to clipboard

Webpack help

Open gregbia opened this issue 6 years ago • 3 comments

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..

gregbia avatar Dec 23 '18 12:12 gregbia

This is the webpack that I am working with https://codepen.io/anon/pen/romzbj

gregbia avatar Dec 23 '18 19:12 gregbia

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");

davidgolden avatar Jan 02 '19 20:01 davidgolden

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.

swashata avatar Jan 26 '19 07:01 swashata