Skip to content

Commit 555deea

Browse files
authored
docs: note library mode process.env.* replacement (#9130)
1 parent a2b3131 commit 555deea

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/guide/build.md

+4
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ Recommended `package.json` for your lib:
189189
If the `package.json` does not contain `"type": "module"`, Vite will generate different file extensions for Node.js compatibility. `.js` will become `.mjs` and `.cjs` will become `.js`.
190190
:::
191191

192+
::: tip Environment Variables
193+
In library mode, all `import.meta.env.*` usage are statically replaced when building for production. However, `process.env.*` usage are not, so that consumers of your library can dynamically change it. If this is undesirable, you can use `define: { 'process.env.`<wbr>`NODE_ENV': '"production"' }` for example to statically replace them.
194+
:::
195+
192196
## Advanced Base Options
193197

194198
::: warning

0 commit comments

Comments
 (0)