Replies: 4 comments
-
I also faced this issue and found a workaround that probably works for you as well. Install exports.onCreateBabelConfig = ({
actions: {
setBabelPlugin,
},
}) => {
setBabelPlugin({
name: 'babel-plugin-syntax-jsx',
})
} Hope this helps dig into the root cause! |
Beta Was this translation helpful? Give feedback.
-
@chitoku-k Thanks for your comment, it also works for me. Maybe it's the time to close it, but, I guess a deeper explanation would be nice. Unfornaturly, I have no idea. |
Beta Was this translation helpful? Give feedback.
-
We need a little bit more information on how you're adding |
Beta Was this translation helpful? Give feedback.
-
@wardpeet Thanks for your reply. It's not added manually actually but part of the source code of gatsby itself. And, it seems not a problem with this file since gatsby works in the normal flow(gatsby developing/build), but not in my case. I guess it might be some issue with the script that calling babel/react-preset which responsible for parsing JSX. In my script(In the head of the post you will find it), it doesn't work. |
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.
-
My project named docs-engine is a package with predefined
gatsby-config.js
,gatsby-node.js
,gatsby-ssr.js
, and an index.js defined the commands.index.js
This project was created by
gatsby new the-name
so the required packages are recorded at the package.json. I've tried thedevelop
andbuild
command here and it works.Summary
The issue is when it was installed locally
yarn add ../docs-engine
from another project, namedtest-docs-engine
, the commanddevelop
orbuild
ended with an error like:Stepped int the file it said, I found the error line is just code of JSX:
node_modules/docs-engine/.cache/develop-static-entry.js
I guess it might be some issue with react preset which responsible for parsing JSX, but I don't know how to debug, or even collect more clues.
Relevant information
Environment (if relevant)
System:
OS: Windows 10 10.0.18363
CPU: (4) x64 Intel(R) Core(TM) i5-5300U CPU @ 2.30GHz
Binaries:
Node: 12.17.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.9.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.14.5 - C:\Program Files\nodejs\npm.CMD
Languages:
Python: 3.6.3 - /d/programs/python/python
Browsers:
Chrome: 84.0.4147.89
Edge: Spartan (44.18362.449.0)
--
File contents (if changed)
gatsby-config.js
: N/Apackage.json
: N/Agatsby-node.js
: N/Agatsby-browser.js
: N/Agatsby-ssr.js
: N/AThank you for reaching my post! Any help would be great.
Beta Was this translation helpful? Give feedback.
All reactions