Skip to content

0.4.0

Compare
Choose a tag to compare
@zoontek zoontek released this 26 Mar 19:53
· 15 commits to main since this release

⚠️ Breaking change. As a lot of bundlers now statically inline prefixed env variables at build time, the prefix option has been removed.
To uses valienv with these bundlers, you can inline the env variables (keep in mind that it could prevent some minifier optimizations):

import { boolean, string, validate } from "valienv";

export const env = validate({
  env: {
    // you cannot use env: process.env directly
    ANALYTICS_ID: process.env.NEXT_PUBLIC_ANALYTICS_ID,
    ENABLE_CHAT: process.env.NEXT_PUBLIC_ENABLE_CHAT,
  },
  validators: {
    ANALYTICS_ID: string,
    ENABLE_CHAT: boolean,
  },
});