Description
Describe the bug
If you import a package that uses ?? operator in code, create react app will fail when debugging.
This issue seems to appear only when debugging with such a library. (npm run start)
It builds (npm run build) without errors. So the toolchain for start vs build is in question here.
The operator works fine if used directly - not in the imported library code.
Did you try recovering your dependencies?
Issues occurred with multiple CRAs even with reinstalling node modules.
Which terms did you search for in User Guide?
Null Coalescing Operator Create React App
There seems to be an issue about optional chaining.
Environment
Windows 10 10.0.17763
npm 6.14.5
node 14.4.0
Google Chrome was used to ensure async, let, const, classes, and ?? support.
Steps to reproduce
- Create a React App with TypeScript (Haven't tried without TS)
- Create NPM package (TS with target ESNext, module, commonjs, declaration) that uses the ?? operator
- Use package in your app.
- Run start script
Expected behavior
The application should compile and run successfully when started or when built..
Actual behavior
The application fails to compile due to the ?? in the library.
Failed to Compile,
Unexpected token
You may need an additional loader to handle the result of these loaders.
Reproducible demo
If needed I can brew something up. This was found in a work project.