[Help wanted] App broken when setting corejs=3 for '@babel/plugin-transform-runtime'
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- babel, javascript, react-native
- 领域
- build-system, tooling
调研方向
从 babel.config.js 中的 plugin 配置以及报告中显示的生成 bundle 开始。使用 React Native 0.68 和 metro-react-native-babel-preset 0.72.1 重现该故障,然后追踪生成的 core-js runtime 导入为何会使 require 未定义。应用能够完成 bundle 并在没有该异常的情况下运行,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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
- 主要语言
- JavaScript
- 星标
- 5.6k
- 派生
- 702
- 平均合并
- 3 天 2 小时
- 30 天内合并 PR
- 57
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
react/metro 的其他 Issue
-
constant-folding-plugin emits 0/0 (NaN) for arithmetic on destructured bindings可能已有人在做 @cpruijsen 于 8 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 2 天内回复
-
难度 4/5 1-2 天 新手友好度 35/100
维护者通常 2 天内回复
-
[0.83.x] Backport micromatch removal and dotfile/multipart watcher fix together可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 4/5 3-5 天 新手友好度 45/100
维护者通常 2 天内回复
-
`dependencies is not iterable` / `Cannot read property 'reduce' of undefined`: `FileStore` serves zero-prefixed cache files as hits可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 3/5 1-2 天 新手友好度 68/100
维护者通常 2 天内回复
-
Async chunk URLs drop the file extension, so .cjs async imports fail with "Requiring unknown module"可能已有人在做 @dasjideepak 于 19 天前认领。 未关闭
难度 3/5 1-2 天 新手友好度 74/100
react/metro#1959 · 2 条评论 · 2 个 reaction ·
维护者通常 2 天内回复
相似的 Issue
-
BUG
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
[BUG]: filesystem-edit-file converts a CRLF file's line endings to LF on every edit可能已有人在做 @MohammadHijjawi97 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
Mintplex-Labs/anything-llm#6755 ·
维护者通常 1 天内回复
-
type/bug
难度 1/5 1 小时以内 新手友好度 75/100
flarum/framework#5231 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
apache/rocketmq-dashboard#6896 ·
维护者通常 3 天内回复
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复