Skip to content

Commit

Permalink
fix(legacy): import babel once (#19152)
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-ogawa authored Jan 7, 2025
1 parent 8639538 commit 282496d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions packages/plugin-legacy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,9 @@ import {
} from './snippets'

// lazy load babel since it's not used during dev
let babel: typeof import('@babel/core') | undefined
let babel: Promise<typeof import('@babel/core')> | undefined
async function loadBabel() {
if (!babel) {
babel = await import('@babel/core')
}
return babel
return (babel ??= import('@babel/core'))
}

// The requested module 'browserslist' is a CommonJS module
Expand Down

0 comments on commit 282496d

Please sign in to comment.