Replies: 2 comments 1 reply
-
I agree that this is something about |
Beta Was this translation helpful? Give feedback.
-
I think we can mark this as solved. I've finally pinpoint the cause here that is preventing Gatsby from transpiling correctly. It was due to combination babel-node and @std/esm. There was a command utilizing babel-node which then calls Gatsby, which I guess, then calls @std/esm to transform some of the code. This caused some strange behavior in Node 14. Removing babel-node and @std/esm from my package.json fixed transpiling issues for me. @vladar Unfortunately I don't have minimal reproduction to share this with you. I appreciate you trying to help me out here. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Edit: sorry for the long text below!
Greetings,
I am in the process of updating an old project that is currently using Gatsby v1.9 into Gatsby v2.31. It seems I've run into some snags and would like some assistance as I am unsure what else to try at this point to fix the webpack error that I am trying to figure out how to resolve.
Keep in mind, I did not have this error in Gatsby v1.9. I followed along https://www.gatsbyjs.com/docs/reference/release-notes/migrating-from-v1-to-v2/ as I much as I can.
Knowing that Gatsby V2 now uses Babel 7, so in package.json, I removed deprecated babel and its related packages:
to
When I run
yarn gatsby build
I get these errors during "Building Development Bundle"The same error repeats like that about 10 times for different files.

The source code for this:
It looks like Gatsby is not utilizing babel-loader with appropriate presets necessary to transpile this code correctly? I have a feeling that it is not using
@babel/preset-env
and@babel/preset-react
presets like it should?If I transpile that manually, the error for that file goes away:

I tried so many ways to try to resolve this... and am running out of idea how to get Gatsby to transpile them using
@babel/plug-proposal-class-properties
which I believe should be enough to resolve these errors but does not seem to help.Plan A: I've tried re-sorting presets and plugins seeing if the orders was messing up Gatsby's build bundling process somehow. No dice.
Plan B: I've also tried force babel-loader with certain presets needed into
exports.onCreateWebpackConfig
ingatsby-node.js
which ended up not making a difference:I confirmed that it added new rule, but even with new rule, the errors persists. So no dice, I commented the code above out.
Plan C: I've tried updating and locking babel plugin version to
7.12.1
and re-installing the package via yarn again. No DicePlan E: Updated Gatsby CLI... No dice.
Plan D: Added
gatsby-preset-babel
package and updated babelrc to utilize that preset- No dice....
Plan Z: Out of idea.
Any other idea??
My configs/system info below:
.babelrc file:
My package.json (partial):
Some more details from @babel/preset-env with DEBUG flag enabled:
gatsby info:
Some system info:
Beta Was this translation helpful? Give feedback.
All reactions