Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[Help wanted] App broken when setting corejs=3 for '@babel/plugin-transform-runtime'

Open
#1,090 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
babel, javascript, react-native

Research direction

Start with the babel.config.js plugin configuration and the generated bundle shown in the report. Reproduce the failure using React Native 0.68 and metro-react-native-babel-preset 0.72.1, then trace why the generated core-js runtime imports leave require undefined. Done means the app bundles and runs without that exception.

Written by the indexing model from the issue text.

Description

Do you want to request a feature or report a bug?
bug

What is the current behavior?
In the file babel.config.js, I wrote the following code:

plugins: ['@babel/plugin-transform-runtime', { helpers: true, corejs: 3 }]

And the bundle code is as shown:

!(function(e){"use strict";var r=require("@babel/runtime-corejs3/core-js-stable/object/create"),t=(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"),require("@babel/runtime-corejs3/core-js-stable/instance/map"),require("@babel/runtime-corejs3/core-js-stable/instance/slice"),require("@babel/runtime-corejs3/core-js-stable/map")),i=require("@babel/runtime-corejs3/core-js-stable/instance/for-each");require("@babel/runtime-corejs3/core-js-stable/set"),require("@babel/runtime-corejs3/core-js-stable/instance/reverse"),require("@babel/runtime-corejs3/core-js-stable/set-timeout"),require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");e.__r=u,e[__METRO_GLOBAL_PREFIX__+"__d"]=function(e,r,t){if(null!=o[r])return;

And the app went broken, showing exception info like "require is undefined"

If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install and yarn test.

  • react-native: 0.68
  • metro-react-native-babel-preset: 0.72.1

What is the expected behavior?
The babel plugin can import core-js normaly as before.

Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
yarn

Dominant language
JavaScript
Stars
5.6k
Forks
699
Avg merge
2d 19h
Merged PRs (30d)
34

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react/metro

All issues in react/metro

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.