diff --git a/packages/desktop-client/vite.config.mts b/packages/desktop-client/vite.config.mts index 4a0f52e02b2..fe5e14cdb3c 100644 --- a/packages/desktop-client/vite.config.mts +++ b/packages/desktop-client/vite.config.mts @@ -23,6 +23,7 @@ const addWatchers = (): Plugin => ({ }, }); +// Inject build shims using the inject plugin const injectShims = (): Plugin[] => { const buildShims = path.resolve('./src/build-shims.js'); const commonInject = { @@ -34,6 +35,8 @@ const injectShims = (): Plugin[] => { { name: 'inject-build-process', config: () => ({ + // rename process.env in build mode so it doesn't get set to an empty object up by the vite:define plugin + // this isn't needed in serve mode, because vite:define doesn't empty it in serve mode. And defines also happen last anyways in serve mode. define: { 'process.env': `_process.env`, },