Menu

vite build accessing system environment variables

DEV Community: esbuild·Roshan P Shajan·6 months ago
#jdt4tiHO
#dev#code#error#vite#define
Reading 0:00
15s threshold

I have a module bundled and built with vite. I am able to run the vite server, but on building it with vite build, I get the following error.

Error: [commonjs--resolver] Transform failed with 2 errors:
error: The define key "process.env.ProgramFiles(x86)" contains invalid identifier "ProgramFiles(x86)"
error: The define key "process.env.CommonProgramFiles(x86)" contains invalid identifier "CommonProgramFiles(x86)"