Skip to content

Commit 344d302

Browse files
authored
feat: export defaultExternalConditions (#20279)
1 parent ced1343 commit 344d302

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

packages/vite/src/node/config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
DEFAULT_CLIENT_CONDITIONS,
2020
DEFAULT_CLIENT_MAIN_FIELDS,
2121
DEFAULT_CONFIG_FILES,
22+
DEFAULT_EXTERNAL_CONDITIONS,
2223
DEFAULT_PREVIEW_PORT,
2324
DEFAULT_SERVER_CONDITIONS,
2425
DEFAULT_SERVER_MAIN_FIELDS,
@@ -651,7 +652,7 @@ export const configDefaults = Object.freeze({
651652
resolve: {
652653
// mainFields
653654
// conditions
654-
externalConditions: ['node'],
655+
externalConditions: [...DEFAULT_EXTERNAL_CONDITIONS],
655656
extensions: ['.mjs', '.js', '.mts', '.ts', '.jsx', '.tsx', '.json'],
656657
dedupe: [],
657658
/** @experimental */

packages/vite/src/node/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ export const DEFAULT_SERVER_CONDITIONS = Object.freeze(
6464
DEFAULT_CONDITIONS.filter((c) => c !== 'browser'),
6565
)
6666

67+
export const DEFAULT_EXTERNAL_CONDITIONS = Object.freeze(['node'])
68+
6769
/**
6870
* The browser versions that are included in the Baseline Widely Available on 2025-05-01.
6971
*

packages/vite/src/node/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export {
5353
VERSION as version,
5454
DEFAULT_CLIENT_CONDITIONS as defaultClientConditions,
5555
DEFAULT_CLIENT_MAIN_FIELDS as defaultClientMainFields,
56+
DEFAULT_EXTERNAL_CONDITIONS as defaultExternalConditions,
5657
DEFAULT_SERVER_CONDITIONS as defaultServerConditions,
5758
DEFAULT_SERVER_MAIN_FIELDS as defaultServerMainFields,
5859
defaultAllowedOrigins,

packages/vite/src/node/ssr/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export interface SSROptions {
4040
/**
4141
* Conditions that are used during ssr import (including `ssrLoadModule`) of externalized dependencies.
4242
*
43-
* @default []
43+
* @default ['node']
4444
*/
4545
externalConditions?: string[]
4646

0 commit comments

Comments
 (0)