How to get env/define to work? #628
-
|
Hello hi~ I've been trying to figure out how to use env or define as explain in the document to set the variable into a build during compilation. But I can't seem to get the env into Im testing on version //tsdown.config.ts
import { defineConfig } from 'tsdown'
export default defineConfig({
outDir: 'build',
clean: true,
env: { "CUSTOM": 'custom1', "process.env.CUSTOM": 'custom1' },
define: { "CUSTOM": 'custom2', "process.env.CUSTOM": 'custom2' },
inputOptions: { transform: { define: { 'process.env.CUSTOM': 'custom3' } } }
})//index.ts
const { CUSTOM } = process.env;
console.log(CUSTOM); |
Beta Was this translation helpful? Give feedback.
Answered by
sxzz
Dec 3, 2025
Replies: 1 comment 1 reply
-
|
Use the literal expression |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
james-superdough
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use the literal expression
process.env.CUSTOMrather than object destructuring.