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

creating isolated bundles

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, react-native
Domain
build-system

Research direction

Start by examining Metro's transformer handling of globalPrefix and bundle generation; the issue provides no file or test entry point. Compare how multiple bundles are loaded from the native side and how sourcemaps are preserved. Done means bundles remain isolated without globalPrefix collisions and sourcemaps continue to work.

Written by the indexing model from the issue text.

Description

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.

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.