Skip to content

[BREAKING] Remove AMD bundles (Ember 7.0)#21102

Closed
wagenet wants to merge 7 commits intoemberjs:mainfrom
wagenet:remove-amd-bundles
Closed

[BREAKING] Remove AMD bundles (Ember 7.0)#21102
wagenet wants to merge 7 commits intoemberjs:mainfrom
wagenet:remove-amd-bundles

Conversation

@wagenet
Copy link
Member

@wagenet wagenet commented Feb 19, 2026

Summary

Implements RFC #1101 (Deprecate Ember Vendor Bundles). Partially addresses #21089.

The four AMD bundles deprecated in 6.10.0 are now removed for 7.0:

  • dist/ember.debug.js
  • dist/ember.prod.js
  • dist/ember-testing.js
  • dist/ember-template-compiler.js

All classic builds now consume ember-source as a v2 addon via ember-auto-import. The use-ember-modules optional feature is removed — the ESM module graph is the only mode.

Changes

Core removal

  • rollup.config.mjs: Remove AMD build configs (legacyBundleConfig, templateCompilerConfig, amdDefineSupport, etc.). Add dist/package.json ({"type":"module"}) and dist/ember-template-compiler.js (ESM re-export) so that @embroider/compat and babel-plugin-ember-template-compilation, which hardcode dist/ember-template-compiler.js, can continue to require() it via Node 20.19+'s unflagged require(esm).
  • broccoli/amd-compat-entrypoints/: Delete directory
  • packages/loader/: Delete package (only used by AMD bundles)
  • lib/index.js: Remove useEmberModules conditional — ESM paths are now unconditional. Fix implicit-modules paths for all exposedDependencies() packages (@glimmer/*, @simple-dom/*, dag-map, route-recognizer, router_js, rsvp): these were referenced as flat .js files but the build emits them as pkg/index.js directories. treeForVendor now creates empty shim files (renamed emberVendorShims) to satisfy ember-cli's expectation that these paths exist in vendor.js.
  • package.json: Remove AMD bundle entries from exports and files; add dist/package.json and dist/ember-template-compiler.js to exports and files.
  • packages/@ember/-internals/deprecations/index.ts: Remove DEPRECATE_AMD_BUNDLES (until: 7.0.0 reached)
  • tsconfig/compiler-options.json: Remove require path mapping (pointed to deleted loader types)
  • types/publish.mjs: Remove loader from REMAPPED_LOCATION_MODULES
  • Node tests: Rewrite to use ESM dynamic imports of individual dist packages via a new tests/node/helpers/ember-esm.js loader. The non-template-compiler dist packages leave @embroider/macros as a live external import (Embroider resolves it at app build time); a Node.js ESM loader hook (tests/node/helpers/macros-loader.mjs, registered via NODE_OPTIONS in test:node) stubs it so packages are directly importable in Node.js. Tests covering FastBoot/SSR rendering, server-side component rendering, and instrumentation are all present and passing.
  • Smoke tests: Remove explicit compilerPath from babel configs (auto-discovered by babel-plugin-ember-template-compilation); remove classicUseModulesFeature scenario. Update app-template to packages that don't access the ember barrel (ember-cli-app-version@7, @ember/test-helpers@5, ember-qunit@9); call loadTests() explicitly (ember-qunit@9 removed it from start()).

Test plan

  • pnpm lint — passes
  • pnpm build:types — passes
  • pnpm type-check — passes
  • pnpm vite build --mode=development — passes
  • pnpm test — 8684 pass, 23 skip, 0 fail
  • pnpm build && pnpm test:node — 69 pass
  • pnpm test:blueprints — passes
  • ALL_DEPRECATIONS_ENABLED=true pnpm test — passes
  • OVERRIDE_DEPRECATION_VERSION=15.0.0 pnpm test — passes
  • Smoke tests (classic-basics, embroiderWebpack-basics, embroiderVite-basics) — all pass

🤖 Generated with Claude Code

@wagenet wagenet marked this pull request as draft February 19, 2026 00:49
wagenet and others added 2 commits February 18, 2026 17:09
Implements RFC emberjs#1101 (Deprecate Ember Vendor Bundles). The four AMD
bundles deprecated in 6.10.0 are now removed:
- dist/ember.debug.js
- dist/ember.prod.js
- dist/ember-testing.js
- dist/ember-template-compiler.js

The ESM template compiler at dist/packages/ember-template-compiler/index.js
is the only supported template compiler going forward. The use-ember-modules
optional feature is now the only mode — all classic builds use ember-auto-import
to consume ember-source as a v2 addon.

- Remove AMD rollup build configs (legacyBundleConfig, templateCompilerConfig,
  amdDefineSupport, concatenateAMDEntrypoints, licenseAndLoader)
- Delete broccoli/amd-compat-entrypoints/ and packages/loader/
- Make lib/index.js unconditionally use ESM paths
- Remove DEPRECATE_AMD_BUNDLES deprecation entry (until: 7.0.0 reached)
- Update package.json exports and files
- Remove AMD-dependent node tests; update template-compiler-test for ESM
- Update smoke-test babel configs to use ESM compiler path
- Remove classicUseModulesFeature smoke-test scenario (now the only mode)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Contributor

github-actions bot commented Feb 19, 2026

Estimated Asset Sizes

Diff

--- main/out.txt	2026-02-17 19:37:18.000000000 +0000
+++ pr/./pr-22201294522/out.txt	2026-02-19 21:43:30.000000000 +0000
@@ -1,15 +1,15 @@
 ╔═══════╤═══════════╤═══════════╗
 ║       │ Min       │ Gzip      ║
 ╟───────┼───────────┼───────────╢
-║ Total │ 351.99 KB │ 203.84 KB ║
+║ Total │ 351.79 KB │ 203.76 KB ║
 ╚═══════╧═══════════╧═══════════╝
 
 ╔══════════════════════╤═══════════╤═══════════╗
 ║ @ember/*             │ Min       │ Gzip      ║
 ╟──────────────────────┼───────────┼───────────╢
-║ Total                │ 313.39 KB │ 181.91 KB ║
+║ Total                │ 313.2 KB  │ 181.82 KB ║
 ╟──────────────────────┼───────────┼───────────╢
-║ -internals           │ 36.65 KB  │ 26.22 KB  ║
+║ -internals           │ 36.46 KB  │ 26.13 KB  ║
 ║ application          │ 13.23 KB  │ 8.05 KB   ║
 ║ array                │ 13.01 KB  │ 7.46 KB   ║
 ║ canary-features      │ 304 B     │ 389 B     ║

Details

This PRmain
╔═══════╤═══════════╤═══════════╗
║       │ Min       │ Gzip      ║
╟───────┼───────────┼───────────╢
║ Total │ 351.79 KB │ 203.76 KB ║
╚═══════╧═══════════╧═══════════╝

╔══════════════════════╤═══════════╤═══════════╗
║ @ember/*             │ Min       │ Gzip      ║
╟──────────────────────┼───────────┼───────────╢
║ Total                │ 313.2 KB  │ 181.82 KB ║
╟──────────────────────┼───────────┼───────────╢
║ -internals           │ 36.46 KB  │ 26.13 KB  ║
║ application          │ 13.23 KB  │ 8.05 KB   ║
║ array                │ 13.01 KB  │ 7.46 KB   ║
║ canary-features      │ 304 B     │ 389 B     ║
║ component            │ 2.05 KB   │ 1.64 KB   ║
║ controller           │ 1.96 KB   │ 1.41 KB   ║
║ debug                │ 11.69 KB  │ 8.12 KB   ║
║ deprecated-features  │ 31 B      │ 77 B      ║
║ destroyable          │ 561 B     │ 383 B     ║
║ enumerable           │ 259 B     │ 387 B     ║
║ helper               │ 1.08 KB   │ 811 B     ║
║ instrumentation      │ 2.43 KB   │ 1.79 KB   ║
║ modifier             │ 1.22 KB   │ 965 B     ║
║ object               │ 35.94 KB  │ 22.16 KB  ║
║ owner                │ 159 B     │ 178 B     ║
║ renderer             │ 630 B     │ 487 B     ║
║ routing              │ 59.3 KB   │ 34.12 KB  ║
║ runloop              │ 2.36 KB   │ 1.5 KB    ║
║ service              │ 1 KB      │ 845 B     ║
║ template             │ 654 B     │ 541 B     ║
║ template-compilation │ 429 B     │ 366 B     ║
║ template-compiler    │ 123.08 KB │ 59.45 KB  ║
║ template-factory     │ 370 B     │ 374 B     ║
║ test                 │ 923 B     │ 627 B     ║
║ utils                │ 4.11 KB   │ 3.6 KB    ║
║ version              │ 55 B      │ 131 B     ║
╚══════════════════════╧═══════════╧═══════════╝

╔═════════════════╤══════════╤══════════╗
║ @glimmer/*      │ Min      │ Gzip     ║
╟─────────────────┼──────────┼──────────╢
║ Total           │ 38.6 KB  │ 21.94 KB ║
╟─────────────────┼──────────┼──────────╢
║ destroyable     │ 2.77 KB  │ 1.39 KB  ║
║ encoder         │ 81 B     │ 171 B    ║
║ env             │ 38 B     │ 87 B     ║
║ global-context  │ 886 B    │ 545 B    ║
║ manager         │ 977 B    │ 608 B    ║
║ node            │ 175 B    │ 260 B    ║
║ opcode-compiler │ 1.11 KB  │ 894 B    ║
║ owner           │ 159 B    │ 202 B    ║
║ program         │ 252 B    │ 301 B    ║
║ reference       │ 548 B    │ 531 B    ║
║ runtime         │ 10.32 KB │ 5.32 KB  ║
║ tracking        │ 1.34 KB  │ 1.16 KB  ║
║ util            │ 1.94 KB  │ 1.68 KB  ║
║ validator       │ 15.75 KB │ 6.96 KB  ║
║ vm              │ 495 B    │ 569 B    ║
║ wire-format     │ 1.84 KB  │ 1.35 KB  ║
╚═════════════════╧══════════╧══════════╝
╔═══════╤═══════════╤═══════════╗
║       │ Min       │ Gzip      ║
╟───────┼───────────┼───────────╢
║ Total │ 351.99 KB │ 203.84 KB ║
╚═══════╧═══════════╧═══════════╝

╔══════════════════════╤═══════════╤═══════════╗
║ @ember/*             │ Min       │ Gzip      ║
╟──────────────────────┼───────────┼───────────╢
║ Total                │ 313.39 KB │ 181.91 KB ║
╟──────────────────────┼───────────┼───────────╢
║ -internals           │ 36.65 KB  │ 26.22 KB  ║
║ application          │ 13.23 KB  │ 8.05 KB   ║
║ array                │ 13.01 KB  │ 7.46 KB   ║
║ canary-features      │ 304 B     │ 389 B     ║
║ component            │ 2.05 KB   │ 1.64 KB   ║
║ controller           │ 1.96 KB   │ 1.41 KB   ║
║ debug                │ 11.69 KB  │ 8.12 KB   ║
║ deprecated-features  │ 31 B      │ 77 B      ║
║ destroyable          │ 561 B     │ 383 B     ║
║ enumerable           │ 259 B     │ 387 B     ║
║ helper               │ 1.08 KB   │ 811 B     ║
║ instrumentation      │ 2.43 KB   │ 1.79 KB   ║
║ modifier             │ 1.22 KB   │ 965 B     ║
║ object               │ 35.94 KB  │ 22.16 KB  ║
║ owner                │ 159 B     │ 178 B     ║
║ renderer             │ 630 B     │ 487 B     ║
║ routing              │ 59.3 KB   │ 34.12 KB  ║
║ runloop              │ 2.36 KB   │ 1.5 KB    ║
║ service              │ 1 KB      │ 845 B     ║
║ template             │ 654 B     │ 541 B     ║
║ template-compilation │ 429 B     │ 366 B     ║
║ template-compiler    │ 123.08 KB │ 59.45 KB  ║
║ template-factory     │ 370 B     │ 374 B     ║
║ test                 │ 923 B     │ 627 B     ║
║ utils                │ 4.11 KB   │ 3.6 KB    ║
║ version              │ 55 B      │ 131 B     ║
╚══════════════════════╧═══════════╧═══════════╝

╔═════════════════╤══════════╤══════════╗
║ @glimmer/*      │ Min      │ Gzip     ║
╟─────────────────┼──────────┼──────────╢
║ Total           │ 38.6 KB  │ 21.94 KB ║
╟─────────────────┼──────────┼──────────╢
║ destroyable     │ 2.77 KB  │ 1.39 KB  ║
║ encoder         │ 81 B     │ 171 B    ║
║ env             │ 38 B     │ 87 B     ║
║ global-context  │ 886 B    │ 545 B    ║
║ manager         │ 977 B    │ 608 B    ║
║ node            │ 175 B    │ 260 B    ║
║ opcode-compiler │ 1.11 KB  │ 894 B    ║
║ owner           │ 159 B    │ 202 B    ║
║ program         │ 252 B    │ 301 B    ║
║ reference       │ 548 B    │ 531 B    ║
║ runtime         │ 10.32 KB │ 5.32 KB  ║
║ tracking        │ 1.34 KB  │ 1.16 KB  ║
║ util            │ 1.94 KB  │ 1.68 KB  ║
║ validator       │ 15.75 KB │ 6.96 KB  ║
║ vm              │ 495 B    │ 569 B    ║
║ wire-format     │ 1.84 KB  │ 1.35 KB  ║
╚═════════════════╧══════════╧══════════╝

wagenet and others added 2 commits February 19, 2026 10:53
…s paths, smoke-test deps

Three issues discovered after the AMD bundle removal:

1. @embroider/compat and babel-plugin-ember-template-compilation hardcode
   `dist/ember-template-compiler.js`. Add an ESM re-export at that path plus
   `dist/package.json` with `{"type":"module"}` so that Node 20.19+
   `require(esm)` works on it without a separate CJS build.

2. The `implicit-modules` paths in `lib/index.js` for all `exposedDependencies()`
   packages (@glimmer/*, @simple-dom/*, dag-map, route-recognizer, router_js, rsvp)
   referenced non-existent flat `.js` files. The rollup build actually emits
   these as `pkg/index.js` directories. This was masked by the AMD bundle
   (which provided those AMD modules directly); without the bundle, AMD module
   resolution for these packages was broken in classic and embroider/webpack builds.

3. The smoke-test app-template was using packages that access the `ember` barrel
   (`@ember/test-helpers@3.x` via Ember._ContainerProxyMixin, `ember-qunit@8`
   via Ember.Test.adapter) which throws in Ember 7.0. Update to:
   - ember-cli-app-version@7 (uses @ember/-internals/metal directly)
   - @ember/test-helpers@5.x (v2 addon, no barrel access)
   - ember-qunit@9 (uses setAdapter/setTesting directly, no barrel)
   - ember-qunit@9 removed loadTests() from start(); call it explicitly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
babel-plugin-ember-template-compilation auto-discovers the template
compiler path, so the explicit compilerPath option is unnecessary.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review February 19, 2026 20:39
@NullVoxPopuli
Copy link
Contributor

I'm trying to bring the node tests back over here: #21105 -- but as ESM

@kategengler
Copy link
Member

Def doesn't close #21089.

wagenet and others added 3 commits February 19, 2026 13:18
The AMD removal commit deleted node tests that depended on loading
dist/ember.debug.js globally. This restores them using ESM dynamic
imports of the individual dist packages.

Key additions:
- tests/node/helpers/ember-esm.js: async loader caching all needed dist
  packages, including a compile() helper using precompile + createTemplateFactory
- tests/node/helpers/build-owner.js: rewritten to accept modules object
  instead of the Ember barrel
- tests/node/helpers/setup-component.js: async beforeEach using loadEmberModules()
- tests/node/helpers/setup-app.js: async beforeEach using loadEmberModules()
- tests/node/instrumentation-test.js: direct ESM import of instrumentation module
- Restored unchanged: assert-html-matches.js, component-rendering-test.js,
  app-boot-test.js, visit-test.js

The non-template-compiler dist packages leave @embroider/macros as a live
external import (Embroider replaces it at app build time). Running them
directly in Node.js causes isDevelopingApp() to throw. Fixed via a Node.js
ESM loader hook (macros-loader.mjs) registered by NODE_OPTIONS in test:node,
which redirects @embroider/macros to a stub returning true for debug flags.

Test count: 50 → 69, all passing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mkdirSync('dist', { recursive: true });
writeFileSync('dist/package.json', JSON.stringify({ type: 'module' }));

// ESM re-export at the legacy path that @embroider/compat and babel-plugin hardcode
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From RFC Review: dist/package.json just with a type module is suspicious

@ef4
Copy link
Contributor

ef4 commented Feb 20, 2026

Open issues:

  • the extra nested package.json as a way to indicate type: 'module' is bad, let's find a different way.
  • the point of the node tests is supposed to be that a consumer can evaluate our published stuff in node. The tests are faking that by introducing complicated macro machinery. Instead we should be producing a build that doesn't need any macro machinery. Options here:
    • produce a node-specific build with no macros and use export conditions to point at it (this is already the case for how the ESM ember-template-compiler bundle is built, precisely because we want it to work with no build in node)
    • change all the builds to compile out macros in favor of debug vs prod export conditions. Right now, the debug/prod switch is the only use of macros, so it could be replaced in that way. This would preclude us from using macros going forward for other things though, like feature stripping.

@NullVoxPopuli
Copy link
Contributor

Appreciate your efforts!

This PR has been superseded by:

And has helped generate a number of PRs that progress us towards getting our v7 cleanup

tytyty

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.

4 participants