diff options
Diffstat (limited to 'packages/frontend-embed/vite.config.ts')
| -rw-r--r-- | packages/frontend-embed/vite.config.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/packages/frontend-embed/vite.config.ts b/packages/frontend-embed/vite.config.ts index a057581b3a..eb57db9774 100644 --- a/packages/frontend-embed/vite.config.ts +++ b/packages/frontend-embed/vite.config.ts @@ -8,6 +8,7 @@ import locales from '../../locales/index.js'; import meta from '../../package.json'; import packageInfo from './package.json' with { type: 'json' }; import pluginJson5 from './vite.json5.js'; +import pluginRemoveUnrefI18n from '../frontend-builder/rollup-plugin-remove-unref-i18n'; const url = process.env.NODE_ENV === 'development' ? yaml.load(await fsp.readFile('../../.config/default.yml', 'utf-8')).url : null; const host = url ? (new URL(url)).hostname : undefined; @@ -85,6 +86,7 @@ export function getConfig(): UserConfig { plugins: [ pluginVue(), + pluginRemoveUnrefI18n(), pluginJson5(), ], @@ -135,15 +137,20 @@ export function getConfig(): UserConfig { manifest: 'manifest.json', rollupOptions: { input: { - app: './src/boot.ts', + i18n: './src/i18n.ts', + entry: './src/boot.ts', }, external: externalPackages.map(p => p.match), + preserveEntrySignatures: 'allow-extension', output: { manualChunks: { vue: ['vue'], + // dependencies of i18n.ts + 'config': ['@@/js/config.js'], }, - chunkFileNames: process.env.NODE_ENV === 'production' ? '[hash:8].js' : '[name]-[hash:8].js', - assetFileNames: process.env.NODE_ENV === 'production' ? '[hash:8][extname]' : '[name]-[hash:8][extname]', + entryFileNames: 'scripts/[hash:8].js', + chunkFileNames: 'scripts/[hash:8].js', + assetFileNames: 'assets/[hash:8][extname]', paths(id) { for (const p of externalPackages) { if (p.match.test(id)) { |