Bug when rendering in production Nextjs fonts

Asked

Viewed 170 times

0

Talk people! I’m creating a static website with Nextjs and Styled-Components. Everything happens well in the development environment, but when putting into production imports of sources do not work.

@font-face {
    font-family: "Impact";
    src: url("/fonts/impact.ttf") format("ttf")
} 

I have already disabled the plugins that render the css generated by Styled-Components on the server side to see if it has any effect, but without success.

  • In the build generated, you should probably be giving a 4040 error when trying to access the sources directory. Make sure the sources path is correct. Try to infer from where the url and adjust the path when mounting the build.

  • Oops, the problem was I was importing the wrong font into Styled-Components. In dev environment "worked", it was installed by default in desktop browsers. Thanks for your attention :D

  • vlw man, congratulations. We’re here to help.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.