From eaf933049efd27bc5fd27b8807631f2044dcbd8e Mon Sep 17 00:00:00 2001 From: Alex Grozav Date: Thu, 10 Oct 2024 16:34:08 +0300 Subject: [PATCH] feat(editor): Remove manual chunking from vite (no-changelog) (#11206) --- packages/editor-ui/vite.config.mts | 41 ------------------------------ 1 file changed, 41 deletions(-) diff --git a/packages/editor-ui/vite.config.mts b/packages/editor-ui/vite.config.mts index 80972dcd33..f7d81cc3cf 100644 --- a/packages/editor-ui/vite.config.mts +++ b/packages/editor-ui/vite.config.mts @@ -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 = {}; - - 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,