Skip to content

Commit

Permalink
docs: note library mode process.env.* replacement (#9130)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Jul 15, 2022
1 parent a2b3131 commit 555deea
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/guide/build.md
Expand Up @@ -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
Expand Down

0 comments on commit 555deea

Please sign in to comment.