mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
feat(editor): Remove manual chunking from vite (no-changelog) (#11206)
This commit is contained in:
parent
401275884e
commit
eaf933049e
|
@ -3,41 +3,11 @@ import { resolve } from 'path';
|
|||
import { defineConfig, mergeConfig } from 'vite';
|
||||
import { sentryVitePlugin } from '@sentry/vite-plugin';
|
||||
|
||||
import packageJSON from './package.json';
|
||||
import { vitestConfig } from '../design-system/vite.config.mts';
|
||||
import icons from 'unplugin-icons/vite';
|
||||
import iconsResolver from 'unplugin-icons/resolver';
|
||||
import components from 'unplugin-vue-components/vite';
|
||||
|
||||
const vendorChunks = ['vue', 'vue-router'];
|
||||
const n8nChunks = ['n8n-workflow', 'n8n-design-system', '@n8n/chat'];
|
||||
const ignoreChunks = [
|
||||
'@fontsource/open-sans',
|
||||
'@vueuse/components',
|
||||
// TODO: remove this. It's currently required by xml2js in NodeErrors
|
||||
'stream-browserify',
|
||||
'vue-markdown-render',
|
||||
];
|
||||
|
||||
const isScopedPackageToIgnore = (str: string) => /@codemirror\//.test(str);
|
||||
|
||||
function renderChunks() {
|
||||
const { dependencies } = packageJSON;
|
||||
const chunks: Record<string, string[]> = {};
|
||||
|
||||
Object.keys(dependencies).forEach((key) => {
|
||||
if ([...vendorChunks, ...n8nChunks, ...ignoreChunks].includes(key)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isScopedPackageToIgnore(key)) return;
|
||||
|
||||
chunks[key] = [key];
|
||||
});
|
||||
|
||||
return chunks;
|
||||
}
|
||||
|
||||
const publicPath = process.env.VUE_APP_PUBLIC_PATH || '/';
|
||||
|
||||
const { NODE_ENV } = process.env;
|
||||
|
@ -124,19 +94,8 @@ export default mergeConfig(
|
|||
},
|
||||
},
|
||||
build: {
|
||||
assetsInlineLimit: 0,
|
||||
minify: !!release,
|
||||
sourcemap: !!release,
|
||||
rollupOptions: {
|
||||
treeshake: !!release,
|
||||
output: {
|
||||
manualChunks: {
|
||||
vendor: vendorChunks,
|
||||
n8n: n8nChunks,
|
||||
...renderChunks(),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
vitestConfig,
|
||||
|
|
Loading…
Reference in a new issue