Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

creating isolated bundles

未关闭
#1,618 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
javascript, react-native
领域
build-system

调研方向

首先检查 Metro 的 transformer 对 globalPrefix 的处理以及 bundle 生成;该 issue 没有提供文件或测试入口点。比较从原生端加载多个 bundle 的方式,以及 sourcemaps 的保留方式。完成的标准是 bundle 彼此保持隔离,不发生 globalPrefix 冲突,并且 sourcemaps 继续正常工作。

由索引模型根据 Issue 内容生成。

描述

I’m generating multiple bundles with Metro to load later from the native side.
The problem is that the bundles aren’t isolated. Metro injects variables at the top of each bundle, and those variables get hoisted when the bundles are loaded, potentially overwriting each other. For example, the globalPrefix option in the Metro transformer is supposed to differentiate global symbols per bundle, but it itself gets hoisted and pollutes the global scope, so all bundles end up sharing the same globalPrefix.

Is there a way to force Metro to isolate bundles—for example, by wrapping each bundle in an IIFE? I tried post-processing the bundles manually, but that breaks the sourcemaps.

主要语言
JavaScript
星标
5.7k
派生
706
平均合并
2 天 4 小时
30 天内合并 PR
65

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

react/metro 的其他 Issue

查看 react/metro 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。