DimiMikadze / create-react-library

React NPM library starter kit based on Facebook's create react app
MIT License
602 stars 60 forks source link

Font files not available #81

Closed i-gk closed 4 years ago

i-gk commented 4 years ago

Hello,

I have my font files within a fonts directory and these were referred by my scss files. However when I build the project, the dist does not have the fonts directory and throwing a not found error for the font file.

What should be the correct approach to get this fixed?

System

Node.js version: v12.18.2 NPM or Yarn version: npm 6.14.5 Operating system: Windows 10

Steps to reproduce

  1. Add fonts directory with couple of font files
  2. Refer them in your scss file
  3. try it from example dir
DimiMikadze commented 4 years ago

Hi @i-gk, where exactly are you adding your fonts directory? Try to add the fonts folder inside the src directory.

If it won't work, then probably you need to tweak Webpack's configuration.

i-gk commented 4 years ago

Hey @DimiMikadze yah it is inside the src. I was thinking the same, add a copy command to webpack. But wanted to check if there is built in support first.

DimiMikadze commented 4 years ago

@i-gk, I never tried it, but I think it should be built-in. This discussion should help you: https://stackoverflow.com/questions/41676054/how-to-add-fonts-to-create-react-app-based-projects

i-gk commented 4 years ago

Thank you! I tried this and did not work. Ended up writing a copy command for assets