You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Error: Webpack Compilation Error" with "pragma and pragmaFrag cannot be set when runtime is automatic" when changing Babel configuration with Next.js
#14471
Closed
Vadorequest opened this issue
Jan 10, 2021
· 2 comments
TLDR; A comment in a Cypress file makes E2E Cypress tests fail due to a perfectly fine comment that is interpreted as a JSX pragma. Webpack fails to compile Cypress file since I configured Babel to use automatic runtime with Next.js, only affects Cypress, not Next.js
The text was updated successfully, but these errors were encountered:
Vadorequest
changed the title
Babel error - "Error: Webpack Compilation Error" with "pragma and pragmaFrag cannot be set when runtime is automatic" tue to false-positive comment
"Error: Webpack Compilation Error" with "pragma and pragmaFrag cannot be set when runtime is automatic" when changing Babel configuration with Next.js
Jan 11, 2021
The issue might be Cypress doesn't support automatic mode? Or require some additional configuration for it to work properly?
A similar issue happened with MDX a while ago, basically Emotion provides a way to use JSX "automatic" pragma through Babel config (and avoid writing /* @jsx jsx */ on top of every file using Emotion), but this wasn't properly supported by MDX and led to issues, as explained at mdx-js/mdx#990
I feel like something similar happens here, I changed the babel configuration to make it work with Emotion 11, but it broke Cypress in the process.
This was a Babel/Webpack/TS configuration issue introduced by changing the babel config required by Emotion 11. It has been explained and fixed at UnlyEd/next-right-now#247
Cross-posting as I don't know whether the bug is due to Cypress or Next.js Babel configuration.
See vercel/next.js#20952
The text was updated successfully, but these errors were encountered: