Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack help #9

Open
gregbia opened this issue Dec 23, 2018 · 3 comments
Open

Webpack help #9

gregbia opened this issue Dec 23, 2018 · 3 comments

Comments

@gregbia
Copy link

gregbia commented Dec 23, 2018

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
Copy link
Author

gregbia commented Dec 23, 2018

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

@davidgolden
Copy link

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

@swashata
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants