-
-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Description
Version
System:
OS: macOS 15.0.1
CPU: (8) arm64 Apple M1
Memory: 79.30 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Browsers:
Brave Browser: 132.1.74.50
Chrome: 133.0.6943.99
Safari: 18.0.1Details
In my library, we sanitize and export a set of env variables that can be used in our web apps:
export const squared = (n: number): number => n * n;
export const envVars = {
ASSET_PREFIX: process.env.ASSET_PREFIX,
}But when compiling it with rslib, the process.env.ASSET_PREFIX is replaces with the "auto" value 🤔
Code after compilation:
const squared = (n)=>n * n;
const envVars = {
ASSET_PREFIX: "auto"
};
export { envVars, squared };I have not configured anything about that in my rslib.config.ts file so I would expect to have this without a value and instead keep the original code like:
// compiled code
const squared = (n)=>n * n;
const envVars = {
ASSET_PREFIX: process.env.ASSET_PREFIX_, // <-- this should keep as the original code
};
export { envVars, squared };Reproduce link
https://github.com/giancarlosisasi/rslib-bug-env-var
Reproduce Steps
git clone https://github.com/giancarlosisasi/rslib-bug-env-varpnpm install && pnpm build- Check the file
dist/index.js, there you can see the "auto" value in theenvVars.ASSET_PREFIXeven when that variable was not configured in the rslib.config.ts
Metadata
Metadata
Assignees
Labels
No labels