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
Can't resolve fs / fs in normalize-file.js ? #7
Comments
Same issue here. Did you close the issue because you solved it? How? Could this be a solution? |
Tried adding // gatsby-node.js
exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
node: {
fs: 'empty'
}
})
} No joy, any luck you guys @leafac @jesterbeaver or any advice from @renvrant ? Could we re-open this otherwise? Cheers |
You need to modify your netlify config.
You should probably include this as the last plugin listed in |
@mysterybear you shouldn't need it in the root node config unless there is another unmentioned dependency running around. |
@mysterybear: The progress I made on the issue is that I think I now understand why it occurs in the first place. In this starter there’s code like this that requires MDX. This code is being interpreted as if it were running on the browser. Of course, this is Gatsby we’re talking about, and Gatsby precompiles stuff during build time to generate a static site. But still, the code behaves as if it were interpreted in the browser. The problem is that MDX seems to use The solution seems to be to tell webpack (which Gatsby is using under the hood) to provide an |
I can shed more light on the problem. Gatsby has 2 major build steps. Step 1 runs entirely in node and is responsible for validating schema, running queries, loading data, performing SSR to generate the static elements and so on. During step 2, Gatsby builds the site with a browser config because it expects there may be some elements that are intended to run in the browser (like dynamically loaded data at runtime, or maybe a netlify admin application!). This 2nd stage is what dies if you included a gatsby symbol inside some component that gatsby doesn't handle during Stage 1. In the case of this starter, any component you expose to your CMS like |
Seems to be. If I remove it from gatsby-node.js, I get the same problem:
|
Interesting. Thanks for the correction! |
This is such a cool project! But I can't get it to work. Cloned it once via
gatsby cli
& then tried a second time viagit clone + repo link
. Apart from lots of warnings duringyarn
,gatsby develop
gives me:Tried fixing it by
yarn add fs
, but didn't work. I'm not sure what to do. Any ideas?The text was updated successfully, but these errors were encountered: