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`.
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2023-02-14 16:10:39 +01:00 committed by GitHub
parent 36108f82a1
commit 522ddfc0cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,11 +51,14 @@ const lodashAliases = ['orderBy', 'camelCase', 'cloneDeep', 'isEqual', 'startCas
replacement: require.resolve(`lodash-es/${name}`), replacement: require.resolve(`lodash-es/${name}`),
})); }));
const { NODE_ENV } = process.env;
export default mergeConfig( export default mergeConfig(
defineConfig({ defineConfig({
define: { define: {
// This causes test to fail but is required for actually running it // 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}'`, BASE_PATH: `'${publicPath}'`,
}, },
plugins: [ plugins: [