Environment variables
This page describes how Rslib handles import.meta.env.* and process.env.* references in source code when generating library output.
Default behavior
Rslib handles built-in env preset references differently for each output format:
The preset values in the table follow Rsbuild's environment variable handling; see Rsbuild - Environment Variables for details.
Preserved references can be replaced by a downstream build tool or resolved by the target runtime.
Replacing with specific values at build time
To replace an environment variable with a specific value when building the library, define it explicitly with source.define:
rslib.config.ts
