Skip to content

Commit

Permalink
docs: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaskuske committed Apr 10, 2022
1 parent 0d391f0 commit bc6e44b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions docs/config/index.md
Expand Up @@ -158,8 +158,10 @@ export default defineConfig(({ command, mode }) => {

- To be consistent with [esbuild behavior](https://esbuild.github.io/api/#define), expressions must either be a JSON object (null, boolean, number, string, array, or object) or a single identifier.

::: warning
Because it's implemented as straightforward [RegExp-based](https://github.com/vitejs/vite/blob/4aecf7dc6df6878b7de3c395a0a9ec8fc0f6a1af/packages/vite/src/node/plugins/define.ts#L70-L87) text replacements without any syntax analysis, we recommend using `define` for CONSTANTS only.
- Replacements are performed only when the match is surrounded by other letters, numbers, `_` or `$`.

::: warning
Because it's implemented as straightforward text replacements without any syntax analysis, we recommend using `define` for CONSTANTS only.

For example, `process.env.FOO` and `__APP_VERSION__` are good fits. But `process` or `global` should not be put into this option. Variables can be shimmed or polyfilled instead.
:::
Expand Down

0 comments on commit bc6e44b

Please sign in to comment.