hupe1980 / gatsby-plugin-webfonts

A Gatsby plugin to handle cdn, base64 and self hosted webfonts
MIT License
55 stars 0 forks source link

Cant resolve /.cache/webfonts/webfonts.css after updating to 2.1 / Gatsby 3 #22

Closed tariknz closed 3 years ago

tariknz commented 3 years ago

Hi, starting to get this message for some strange reason. This is on windows.

 ERROR #98124  WEBPACK

Generating development SSR bundle failed

Can't resolve '/.cache/webfonts/webfonts.css' in
'C:\xx\node_modules\gatsby-plugin-webfonts'

If you're trying to use a package make sure that '/.cache/webfonts/webfonts.css' is installed. If you're trying to   
use a local file make sure that the path is correct.

File: node_modules\gatsby-plugin-webfonts\gatsby-ssr.js:24:39

not finished Building development bundle - 10.767s

npm ERR! code 1
npm ERR! path C:\xx
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c gatsby develop -H 0.0.0.0

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\xx\2021-05-31T08_20_30_657Z-debug.log

Error seems to be related to webpack but not sure what to do.

Current gatsby deps:

    "gatsby": "^3.6.1",
    "gatsby-image": "^3.6.0",
    "gatsby-plugin-material-ui": "^3.0.1",
    "gatsby-plugin-react-helmet": "^4.6.0",
    "gatsby-plugin-sharp": "^3.6.0",
    "gatsby-plugin-sitemap": "^4.2.0",
    "gatsby-plugin-styled-components": "^4.6.0",
    "gatsby-plugin-webfonts": "^2.1.0",
    "gatsby-source-filesystem": "^3.6.0",
    "gatsby-transformer-sharp": "^3.6.0",

Not sure if its obvious what's going on but let me know if you need more information.

samturner3 commented 3 years ago

Same here on Mac>

Screen Shot 2021-06-02 at 11 41 27 am

Also on gatsby: 3.6.1

adonig commented 3 years ago

I got this error because I'm using gatsby-theme-material-ui and pass a webFontsConfig object to prevent Roboto from loading. Interestingly commenting out the config caused the error to go away:

  {
    resolve: `gatsby-theme-material-ui`,
    // options: {
    //   webFontsConfig: {
    //     fonts: {}, // Do not load Roboto.
    //   },
    // },
  },
alec-francis commented 3 years ago

Plus 1 to this issue. I'm getting the same error after upgrading our project to Gatsby Version 3

robmarshall commented 3 years ago

Im getting this, and not using material ui.

hupe1980 commented 3 years ago

Unfortunately, I cannot recreate the failure. The error does not occur locally or in the CI. Can someone create a minimal reproduction?

tariknz commented 3 years ago

@hupe1980 I've managed to get it working in the end after cleaning up node_modules (deleting and reinstalling all packages). This happened to me after I upgraded from gatsby 2.x so it might've had some packages lingering around causing it.

I'm happy to close it on my end but I feel like others are coming across this issue, might be better if we can narrow down exactly what could be causing it. Not really sure.

hupe1980 commented 3 years ago

I close the issue. If it happens again, please create a new issue