You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Additional allowed conditions when resolving [Conditional Exports](https://nodejs.org/api/packages.html#packages_conditional_exports) from a package.
123
123
@@ -136,7 +136,7 @@ A package with conditional exports may have the following `exports` field in its
136
136
137
137
Here, `import` and `require` are "conditions". Conditions can be nested and should be specified from most specific to least specific.
138
138
139
-
Some of the default conditions (`production`, `development`) are only applied when the requirements are met. For example, `production`is only applied when `process.env.NODE_ENV === 'production'`. The `resolve.conditions` config option allows specifying additional allowed conditions and those conditions will be applied unconditionally.
139
+
`DEV_PROD_CONDITION` is a special variable that is replaced with `production` or `development` depending on the value of `process.env.NODE_ENV`. It is replaced with `production` when `process.env.NODE_ENV === 'production'` and `development` otherwise.
140
140
141
141
Note that `import`, `require`, `default` conditions are always applied if the requirements are met.
These conditions are used in the plugin pipeline, and only affect non-externalized dependencies during the SSR build. Use `ssr.resolve.externalConditions` to affect externalized imports.
Copy file name to clipboardExpand all lines: docs/guide/migration.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,13 @@ In Vite 5, the default value for `resolve.conditions` was `[]` and some conditio
21
21
From Vite 6, some of the conditions are no longer added internally and need to be included in the config values.
22
22
The conditions that are no longer added internally for
23
23
24
-
-`resolve.conditions` are `['module', 'browser', 'production', 'development']`
25
-
-`ssr.resolve.conditions` are `['module', 'node', 'production', 'development']`
24
+
-`resolve.conditions` are `['module', 'browser', DEV_PROD_CONDITION]`
25
+
-`ssr.resolve.conditions` are `['module', 'node', DEV_PROD_CONDITION]`
26
26
27
-
The default values for those options are updated to the corresponding values and `ssr.resolve.conditions` no longer uses `resolve.conditions` as the default value.
27
+
The default values for those options are updated to the corresponding values and `ssr.resolve.conditions` no longer uses `resolve.conditions` as the default value. Note that `DEV_PROD_CONDITION` is a special variable that is replaced with `production` or `development` depending on the value of `process.env.NODE_ENV`.
28
28
29
29
If you specified a custom value for `resolve.conditions` or `ssr.resolve.conditions`, you need to update it to include the new conditions.
30
-
For example, if you previously specified `['custom']` for `resolve.conditions`, you need to specify `['custom', 'module', 'browser', 'production', 'development']` instead.
30
+
For example, if you previously specified `['custom']` for `resolve.conditions`, you need to specify `['custom', 'module', 'browser', DEV_PROD_CONDITION]` instead.
0 commit comments