Skip to content

Commit

Permalink
fix: externalize only in ssr
Browse files Browse the repository at this point in the history
  • Loading branch information
patak-dev committed May 27, 2022
1 parent ef6e8ea commit 2923000
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function resolvePlugins(
asSrc: true,
getDepsOptimizer: () => getDepsOptimizer(config),
shouldExternalize:
isBuild && config.ssr?.target !== 'node-cjs'
isBuild && config.build.ssr && config.ssr?.target !== 'node-cjs'
? (id) => shouldExternalizeForSSR(id, config)
: undefined
}),
Expand Down
1 change: 1 addition & 0 deletions packages/vite/src/node/plugins/ssrRequireHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { arraify } from '../utils'
export function ssrRequireHookPlugin(config: ResolvedConfig): Plugin | null {
if (
config.command !== 'build' ||
!config.build.ssr ||
!config.resolve.dedupe?.length ||
config.ssr?.noExternal === true ||
config.ssr?.target !== 'node-cjs' ||
Expand Down

0 comments on commit 2923000

Please sign in to comment.