utquidem
Version:
The meta-framework suite designed from scratch for frontend-focused modern web development.
14 lines (12 loc) • 414 B
text/typescript
import { EnvironmentVariables } from '../Options';
export const getRollupReplaceKeys = (
env: EnvironmentVariables,
): Record<string, string> => {
const ret = Object.keys(env).reduce((acc, envKey) => {
const envVar = env[envKey];
acc[`process.env.${envKey}`] =
envVar === true ? process.env[envKey]! : JSON.stringify(envVar);
return acc;
}, {} as Record<string, string>);
return ret;
};