"Unexpected token" when compiling #13288
Unanswered
CryptoKira
asked this question in
Q&A
Replies: 1 comment
-
The error indicates that the Babel loader can't interpret the nullish coalescing operator (??). This is often due to an outdated Babel setup. Update react-scripts: Sometimes older versions have outdated dependencies.
Custom Babel Config: Create a .babelrc with support for newer JS features like nullish coalescing. {
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["@babel/plugin-proposal-nullish-coalescing-operator"]
} Transpile Library: As a last resort, manually transpile the offending library. Use babel-cli to output transpiled code into a new directory.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I need to update a legacy site that requires me to import a library.
I'm getting the error below, using react-scripts
Any idea how to fix this?
Beta Was this translation helpful? Give feedback.
All reactions