UNPKG

@jswork/vite-envs

Version:

Vite env manager.

32 lines (31 loc) 795 B
/*! * name: @jswork/vite-envs * description: Vite env manager. * homepage: https://js.work * version: 1.1.3 * date: 2024-02-24 20:26:39 * license: MIT */ import EnvManager from '@jswork/env-manager'; const viteEnv = new EnvManager({ prefix: 'VITE_', harmony: true, }); class ViteEnvs { static setOptions(inOptions) { let env = inOptions.env; env = typeof env === 'string' ? JSON.parse(env) : env; viteEnv.setOptions({ ...inOptions, env }); } static get(inKey) { return viteEnv.get(inKey); } static set(inCmdRc) { return viteEnv.set(inCmdRc); } } // for commonjs es5 require if (typeof module !== 'undefined' && module.exports && typeof wx === 'undefined') { module.exports = ViteEnvs; } export default ViteEnvs;