Skip to content

Commit

Permalink
fix(esbuildDepPlugin): externalize built-in module during SSR (#4904)
Browse files Browse the repository at this point in the history
  • Loading branch information
ygj6 committed Sep 12, 2021
1 parent 3392a8a commit 5cc4587
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/vite/src/node/optimizer/esbuildDepPlugin.ts
Expand Up @@ -6,7 +6,8 @@ import {
isRunningWithYarnPnp,
flattenId,
normalizePath,
isExternalUrl
isExternalUrl,
isBuiltin
} from '../utils'
import { browserExternalId } from '../plugins/resolve'
import { ExportsData } from '.'
Expand Down Expand Up @@ -119,7 +120,7 @@ export function esbuildDepPlugin(
namespace: 'browser-external'
}
}
if (isExternalUrl(resolved)) {
if (isExternalUrl(resolved) || (ssr && isBuiltin(id))) {
return {
path: resolved,
external: true
Expand Down

0 comments on commit 5cc4587

Please sign in to comment.