From 731e8394d315301ac4b19c0d303c8a45950b62bd Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Tue, 18 Feb 2025 17:52:29 +0100 Subject: [PATCH 1/2] build(frontend): use Svelte bundle strategy single --- svelte.config.js | 4 ++++ vite.config.ts | 25 ------------------------- 2 files changed, 4 insertions(+), 25 deletions(-) diff --git a/svelte.config.js b/svelte.config.js index 1c84093421..a69b06864b 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -40,6 +40,10 @@ const config = { version: { name: version + }, + + output: { + bundleStrategy: 'single' } } }; diff --git a/vite.config.ts b/vite.config.ts index 5a123de624..ec0809c67d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -24,31 +24,6 @@ const config: UserConfig = { build: { target: 'es2020', rollupOptions: { - output: { - manualChunks: (id) => { - const folder = dirname(id); - - const lazy = ['@dfinity/nns', '@dfinity/nns-proto', 'html5-qrcode', 'qr-creator']; - - if ( - ['@sveltejs', 'svelte', '@dfinity/gix-components', ...lazy].find((lib) => - folder.includes(lib) - ) === undefined && - folder.includes('node_modules') - ) { - return 'vendor'; - } - - if ( - lazy.find((lib) => folder.includes(lib)) !== undefined && - folder.includes('node_modules') - ) { - return 'lazy'; - } - - return 'index'; - } - }, // Polyfill Buffer for production build plugins: [ inject({ From f60fa1918eef9d1f265b3093e2c00650fd4d036a Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Tue, 18 Feb 2025 17:55:05 +0100 Subject: [PATCH 2/2] chore: fmt --- vite.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vite.config.ts b/vite.config.ts index ec0809c67d..1392505868 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,7 @@ import inject from '@rollup/plugin-inject'; import { sveltekit } from '@sveltejs/kit/vite'; import tailwindcss from '@tailwindcss/vite'; -import { basename, dirname, resolve } from 'node:path'; +import { basename, resolve } from 'node:path'; import { defineConfig, loadEnv, type UserConfig } from 'vite'; import { CSS_CONFIG_OPTIONS, defineViteReplacements, readCanisterIds } from './vite.utils';