Skip to content

Fix packageMeta race condition: scan in-memory bundle instead of disk#21114

Merged
NullVoxPopuli merged 2 commits intonvp/split-buildfrom
copilot/sub-pr-21113
Feb 24, 2026
Merged

Fix packageMeta race condition: scan in-memory bundle instead of disk#21114
NullVoxPopuli merged 2 commits intonvp/split-buildfrom
copilot/sub-pr-21113

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

packageMeta()'s generateBundle hook scanned dist/packages from disk to build ember-addon.renamed-modules. Since generateBundle fires before rollup writes files to disk, and dist/dist-prod are gitignored, a fresh CI build always produced renamed-modules: {} — causing @embroider/vite to have no module redirects and the benchmark app's vite build to fail with handleInvalidResolvedId.

The main branch accidentally worked because packageMeta ran on two sequential configs; the second run's generateBundle fired after the first config had already written its files to disk. The race condition fix (running packageMeta only once on config 1) broke that accidental timing dependency.

Fix

Scan the in-memory bundle parameter of generateBundle instead of the filesystem:

// Before: disk scan — empty on fresh CI build
generateBundle() {
  glob.sync('packages/**/*.js', { cwd: 'dist', nodir: true })
    .filter(...)
}

// After: in-memory bundle — always correct, works on fresh builds
generateBundle(_outputOptions, bundle) {
  Object.keys(bundle)
    .filter(name =>
      name.startsWith('packages/') &&
      !name.startsWith('packages/shared-chunks/') &&
      name.endsWith('.js')
    )
}

pruneEmptyBundles already runs before packageMeta and mutates the shared bundle object in-place, so pruned entries are correctly excluded.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 24, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/repos/emberjs/ember.js/actions/jobs/64726073304/logs
    • Triggering command: /usr/bin/curl curl -s -H Accept: application/vnd.github.v3&#43;json REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Fix production build and package.json export condition Fix packageMeta race condition: scan in-memory bundle instead of disk Feb 24, 2026
Copilot AI requested a review from NullVoxPopuli February 24, 2026 20:09
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review February 24, 2026 20:16
@NullVoxPopuli NullVoxPopuli merged commit f29439e into nvp/split-build Feb 24, 2026
23 of 27 checks passed
@NullVoxPopuli NullVoxPopuli deleted the copilot/sub-pr-21113 branch February 24, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants