babel: [Bug]: After the babel upgraded to 7.25.0, build is failing.

💻

  • Would you like to work on a fix?

How are you using Babel?

babel-loader (webpack)

Input code

“dependencies”: { “@babel/preset-env”: “^7.23.3”, “@babel/preset-react”: “^7.23.3”, }, “devDependencies”: { “@babel/core”: “^7.13.1”, “@babel/plugin-proposal-private-property-in-object”: “^7.21.11”, }

Configuration file name

No response

Configuration

No response

Current and expected behavior

Creating an optimized production build… Failed to compile.

./node_modules/@testing-library/react/dist/@testing-library/react.esm.js 458:51 Module parse failed: Unexpected token (458:51) File was processed with these loaders:

  • ./node_modules/babel-loader/lib/index.js You may need an additional loader to handle the result of these loaders. | // if you don’t like this then either import the pure module | // or set the RTL_SKIP_AUTO_CLEANUP env variable to ‘true’.

if (typeof process === ‘undefined’ || !process.env?.RTL_SKIP_AUTO_CLEANUP) { | // ignore teardown() in code coverage because Jest does not support it | /* istanbul ignore else */

error Command failed with exit code 1.

Build is failing with the above error.

Environment

Babel version: 7.25.0, Node: 14.17.0, yarn: 1.22.19

Possible solution

No response

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (5 by maintainers)

Most upvoted comments

“browserslist”: { “production”: [“>0.2%”, “not dead”, “not op_mini all”, “chrome 79”] }

On adding the chrome 79 to the browserlist, build is working without having to downgrade the babel.

NODE_ENV is set to production. Is there a way to downgrade the babel to 7.24.x to fix this for now?