From 522ddfc0cd3344db3ae9f53960233c3f0c0ee51e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E0=A4=95=E0=A4=BE=E0=A4=B0=E0=A4=A4=E0=A5=8B=E0=A4=AB?= =?UTF-8?q?=E0=A5=8D=E0=A4=AB=E0=A5=87=E0=A4=B2=E0=A4=B8=E0=A5=8D=E0=A4=95?= =?UTF-8?q?=E0=A5=8D=E0=A4=B0=E0=A4=BF=E0=A4=AA=E0=A5=8D=E0=A4=9F=E2=84=A2?= Date: Tue, 14 Feb 2023 16:10:39 +0100 Subject: [PATCH] fix(editor): Fix Vite dev mode (no-changelog) (#5475) because of the updated dev tooling in https://github.com/n8n-io/n8n/pull/5454, vite dev mode is crashing because of the `util` package looking for `process.env`. --- packages/editor-ui/vite.config.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/editor-ui/vite.config.ts b/packages/editor-ui/vite.config.ts index 1c8cffa2949d7..82d3be9ee7d0d 100644 --- a/packages/editor-ui/vite.config.ts +++ b/packages/editor-ui/vite.config.ts @@ -51,11 +51,14 @@ const lodashAliases = ['orderBy', 'camelCase', 'cloneDeep', 'isEqual', 'startCas replacement: require.resolve(`lodash-es/${name}`), })); +const { NODE_ENV } = process.env; + export default mergeConfig( defineConfig({ define: { // This causes test to fail but is required for actually running it - ...(process.env.NODE_ENV !== 'test' ? { global: 'globalThis' } : {}), + ...(NODE_ENV !== 'test' ? { global: 'globalThis' } : {}), + ...(NODE_ENV === 'development' ? { process: { env: {} } } : {}), BASE_PATH: `'${publicPath}'`, }, plugins: [