Skip to content

Commit 22163b6

Browse files
Fix ESM compatibility (Vite) (#1868)
1 parent 6790414 commit 22163b6

File tree

1 file changed

+7
-1
lines changed
  • packages/ember-repl/addon/src/compile/formats/gjs

1 file changed

+7
-1
lines changed

packages/ember-repl/addon/src/compile/formats/gjs/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ async function transform(
9595
const [
9696
// _parser, _traverse, _generator,
9797
_decoratorTransforms,
98-
emberTemplateCompilation,
98+
_emberTemplateCompilation,
9999
] = await Promise.all([
100100
// @babel/* doesn't have the greatest ESM compat yet
101101
// https://github.com/babel/babel/issues/14314#issuecomment-1054505190
@@ -108,9 +108,15 @@ async function transform(
108108
import('babel-plugin-ember-template-compilation'),
109109
]);
110110

111+
// These libraries are compiled incorrectly for cjs<->ESM compat
111112
const decoratorTransforms =
112113
'default' in _decoratorTransforms ? _decoratorTransforms.default : _decoratorTransforms;
113114

115+
const emberTemplateCompilation =
116+
'default' in _emberTemplateCompilation
117+
? _emberTemplateCompilation.default
118+
: _emberTemplateCompilation;
119+
114120
// so we have to use the default export (which is all the exports)
115121
let maybeBabel = (await import('@babel/standalone')) as any;
116122
// Handle difference between vite and webpack in consuming projects...

0 commit comments

Comments
 (0)