Skip to content

Commit

Permalink
fix(legacy): fix browserslist import, close vitejs#11898 (vitejs#11899)
Browse files Browse the repository at this point in the history
  • Loading branch information
ModyQyW authored and futurGH committed Feb 26, 2023
1 parent 3f83801 commit a14faa4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/plugin-legacy/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import type {
types as BabelTypes,
} from '@babel/core'
import colors from 'picocolors'
import { loadConfig as browserslistLoadConfig } from 'browserslist'
import browserslist from 'browserslist'
import type { Options } from './types'
import {
detectModernBrowserCode,
Expand All @@ -45,6 +45,10 @@ async function loadBabel() {
return babel
}

// The requested module 'browserslist' is a CommonJS module
// which may not support all module.exports as named exports
const { loadConfig: browserslistLoadConfig } = browserslist

// Duplicated from build.ts in Vite Core, at least while the feature is experimental
// We should later expose this helper for other plugins to use
function toOutputFilePathInHtml(
Expand Down

0 comments on commit a14faa4

Please sign in to comment.