docs-ko icon indicating copy to clipboard operation
docs-ko copied to clipboard

[SYNC] docs: note library mode process.env.* replacement (#9130)

Open github-actions[bot] opened this issue 3 years ago • 0 comments

docs: note library mode process.env.* replacement (#9130) (555deea)


+++ b/docs/guide/build.md
@@ -189,6 +189,10 @@ Recommended `package.json` for your lib:
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`.
:::
+::: tip Environment Variables
+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.
+:::
+
## Advanced Base Options
::: warning

github-actions[bot] avatar Jul 16 '22 00:07 github-actions[bot]