Skip to content

Commit 3d044e1

Browse files
NullVoxPopuliclaude
andcommitted
Polyfill @ember/owner imports for min-supported scenario
`min-supported` installs `ember-source: ~4.2.0` but the test-app's default `@glimmer/[email protected]` has `import { setOwner } from '@ember/owner'`. `@ember/owner` didn't ship as a module path until ember-source 4.10, so rollup fails with: [vite]: Rollup failed to resolve import "@ember/owner" from ".../@glimmer/[email protected]/node_modules/@glimmer/component/dist/index.js" Use `babel-plugin-ember-polyfill-get-and-set-owner-from-ember-owner` to rewrite those imports back to `@ember/application` (which had `getOwner` /`setOwner` in every 4.x release). The plugin only runs when `ENABLE_COMPAT_BUILD` is set, next to babel-plugin-debug-macros. It's a no-op for scenarios that still resolve `@ember/owner` natively (ember-lts-5.12 and later) because `@ember/application` re-exports the same symbols there. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 0691d3f commit 3d044e1

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

pnpm-lock.yaml

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test-app/babel.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ export default {
5454
flags: [{ source: '@glimmer/env', flags: { DEBUG: true } }],
5555
},
5656
],
57+
'babel-plugin-ember-polyfill-get-and-set-owner-from-ember-owner',
5758
]
5859
: []),
5960
],

test-app/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"@babel/plugin-transform-runtime": "^7.29.0",
3737
"@babel/plugin-transform-typescript": "^7.28.6",
3838
"babel-plugin-debug-macros": "^0.3.4",
39+
"babel-plugin-ember-polyfill-get-and-set-owner-from-ember-owner": "^1.0.4",
3940
"@ember/string": "^4.0.1",
4041
"@ember/test-helpers": "^5.4.1",
4142
"@embroider/core": "^4.4.7",

0 commit comments

Comments
 (0)