Skip to content

Commit 9241d08

Browse files
authoredFeb 2, 2023
fix(legacy): fix browserslist import, close #11898 (#11899)
1 parent c53bfeb commit 9241d08

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎packages/plugin-legacy/src/index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import type {
2323
types as BabelTypes,
2424
} from '@babel/core'
2525
import colors from 'picocolors'
26-
import { loadConfig as browserslistLoadConfig } from 'browserslist'
26+
import browserslist from 'browserslist'
2727
import type { Options } from './types'
2828
import {
2929
detectModernBrowserCode,
@@ -45,6 +45,10 @@ async function loadBabel() {
4545
return babel
4646
}
4747

48+
// The requested module 'browserslist' is a CommonJS module
49+
// which may not support all module.exports as named exports
50+
const { loadConfig: browserslistLoadConfig } = browserslist
51+
4852
// Duplicated from build.ts in Vite Core, at least while the feature is experimental
4953
// We should later expose this helper for other plugins to use
5054
function toOutputFilePathInHtml(

0 commit comments

Comments
 (0)
Please sign in to comment.