Skip to content

Commit 282496d

Browse files
authored
fix(legacy): import babel once (#19152)
1 parent 8639538 commit 282496d

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/plugin-legacy/src/index.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,9 @@ import {
3838
} from './snippets'
3939

4040
// lazy load babel since it's not used during dev
41-
let babel: typeof import('@babel/core') | undefined
41+
let babel: Promise<typeof import('@babel/core')> | undefined
4242
async function loadBabel() {
43-
if (!babel) {
44-
babel = await import('@babel/core')
45-
}
46-
return babel
43+
return (babel ??= import('@babel/core'))
4744
}
4845

4946
// The requested module 'browserslist' is a CommonJS module

0 commit comments

Comments
 (0)