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

Fonts not loaded on build

Open fjpedrosa opened this issue 2 years ago • 2 comments

I had several fonts loaded from files. When I use the dev server, everything is fine, however if I make a build, the resulting static web is not loading fonts. Strange because Webpack is considering that files: Captura de Pantalla 2022-04-26 a las 23 41 24

Also the .css is including that fonts, but the web is not loading the fonts: Captura de Pantalla 2022-04-26 a las 23 43 16

Any help? thanks in advance

PD: Found that IT IS WORKING when the .css files imports the fonts like this: "http:localhost:5500/styleguidist/386536458dadfc278e60.woff2", i.e

Captura de Pantalla 2022-04-27 a las 0 23 59

fjpedrosa avatar Apr 26 '22 21:04 fjpedrosa

Found the solution by setting this webpack config at styleguide.config.js:

  dangerouslyUpdateWebpackConfig(webpackConfig, env) {
    webpackConfig.output.publicPath = '/styleguide/'
    webpackConfig.output.assetModuleFilename = 'static/media/[hash][ext][query]'
    webpackConfig.cache = false
    return webpackConfig
  },

fjpedrosa avatar Apr 30 '22 08:04 fjpedrosa

you can try fontawosome you just need to put rebuild url in index.html file

Manish-Rawat-1186 avatar Jun 05 '22 17:06 Manish-Rawat-1186