Closed lol2x closed 2 years ago
Hello @lol2x ,
I think this error should be fixed in other way...
maybe by additional checking on existing of process.env
and emulating it as an empty object.
Anyway if replace process.env.*
in the vuelayers esm build then there is no possibility to use these env variables with app bundler. These variables are not replaced to allow your bundler replace them with what you need.
I'm not very familiar with vite, but this way of lib bundling was something like a std way before vite. Probably there should be some way to workaround this issue, by a quick searching I found this plugin for vite https://github.com/ElMassimo/vite-plugin-environment
Right now the ESM build does not have NODE_ENV and VUELAYERS_DEBUG variables set. This results in a bug when using Vue2 + Vite because vite does not expose process.env -> vite docs
This PR sets both variables for esm build.