Skip to content

Commit

Permalink
Make the transform function (which uses @babel/standalone) compatible…
Browse files Browse the repository at this point in the history
… with vite
  • Loading branch information
NullVoxPopuli committed Nov 5, 2024
1 parent e134738 commit 8cf9077
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/ember-repl/addon/src/compile/formats/gjs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ async function transform(
): Promise<ReturnType<Babel['transform']>> {
// @babel/standalone is a CJS module....
// so we have to use the default export (which is all the exports)
let babel = (await import('@babel/standalone')).default as Babel;
let maybeBabel = (await import('@babel/standalone')) as Babel;
// Handle difference between vite and webpack in consuming projects...
let babel = 'default' in maybeBabel ? maybeBabel.default : maybeBabel;

return babel.transform(intermediate, {
filename: `${name}.js`,
Expand Down

0 comments on commit 8cf9077

Please sign in to comment.