From 26117efb99c85303e28c2b4ce0e9d19007776488 Mon Sep 17 00:00:00 2001 From: Typed SIGTERM Date: Thu, 10 Oct 2024 22:10:49 +0800 Subject: [PATCH 1/2] docs: add notes for `--env` flag --- docs/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/README.md b/docs/README.md index 38412700..72573c02 100644 --- a/docs/README.md +++ b/docs/README.md @@ -354,6 +354,8 @@ You can use `--env` flag to define compile-time environment variables: tsup src/index.ts --env.NODE_ENV production ``` +Note that `--env.VAR_NAME` only recognizes `process.env.VAR_NAME` and `import.meta.env.VAR_NAME`. + ### Building CLI app When an entry file like `src/cli.ts` contains hashbang like `#!/bin/env node` tsup will automatically make the output file executable, so you don't have to run `chmod +x dist/cli.js`. From 0d65355f417b6df2a451773019ff020e1f5d49e6 Mon Sep 17 00:00:00 2001 From: Typed SIGTERM Date: Fri, 11 Oct 2024 00:32:24 +0800 Subject: [PATCH 2/2] docs: tweak --- docs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index 72573c02..46449dd8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -354,7 +354,7 @@ You can use `--env` flag to define compile-time environment variables: tsup src/index.ts --env.NODE_ENV production ``` -Note that `--env.VAR_NAME` only recognizes `process.env.VAR_NAME` and `import.meta.env.VAR_NAME`. +Note that `--env.VAR_NAME` only recognizes `process.env.VAR_NAME` and `import.meta.env.VAR_NAME`. If you use `process.env`, it will only take effect when it is used as a built-in global variable. Therefore, do not import `process` from `node:process`. ### Building CLI app