Commit 81ef341
Don't run @ember/owner polyfill on ember-source itself
With ember-cli#323 landed, `ember-lts-4.12` flips to:
Uncaught ReferenceError: Cannot access 'getOwner' before initialization
at app-*.js line N
ember-source >= 4.12's `@ember/application/index.js` re-exports the real
implementations from `@ember/owner` as aliases:
import { getOwner as actualGetOwner, setOwner as actualSetOwner }
from '@ember/owner';
export const getOwner = actualGetOwner;
export const setOwner = actualSetOwner;
`babel-plugin-ember-polyfill-get-and-set-owner-from-ember-owner` rewrote
the source of that import to `@ember/application` — turning the module
into a self-import that rollup then collapses into
`const getOwner = getOwner` (TDZ).
The plugin already tries to skip ember-source paths, but the guard only
short-circuits when the file is outside `.embroider/`; in a vite
compat build ember-source lives at
`node_modules/.embroider/rewritten-packages/ember-source.*/` so it
fell through and got rewritten. Gate the plugin through babel
`overrides` with a `test` filter that excludes any path containing
`/ember-source/`. The polyfill still runs where it needs to
(e.g. `@glimmer/[email protected]`'s `import { setOwner } from
'@ember/owner'`, which is how min-supported started passing in ember-cli#323).
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>1 parent 62fbb6c commit 81ef341
1 file changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | 57 | | |
59 | 58 | | |
60 | 59 | | |
61 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
62 | 73 | | |
63 | 74 | | |
64 | 75 | | |
| |||
0 commit comments