Skip to content

Commit 5806496

Browse files
authored
Split translations into their own chunks. (#3433)
* Split translations into their own chunks. * Split translations into their own chunks. * Split translations into their own chunks.
1 parent 5822ca5 commit 5806496

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

svelte.config.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ const config = {
2626
},
2727
},
2828
version: { name: packagejson.version },
29-
output: {
30-
bundleStrategy: "single",
31-
},
3229
},
3330
};
3431

vite.config.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { type AliasOptions, type UserConfig, defineConfig } from "vite";
77
import { nodePolyfills } from "vite-plugin-node-polyfills";
88
import { lingui } from "@lingui/vite-plugin";
99
import { sveltePreprocessor } from "./src/lingui-svelte";
10+
import { basename, extname } from "path";
1011

1112
export const aliasConfig: AliasOptions = {
1213
// Polyfill stream for the browser. e.g. needed in "Recovery Phrase" features.
@@ -32,6 +33,17 @@ export default defineConfig(({ command, mode }): UserConfig => {
3233
assetsInlineLimit: 0,
3334
emptyOutDir: true,
3435
rollupOptions: {
36+
output: {
37+
manualChunks: (id) => {
38+
// Split translations into individual chunks
39+
console.log("hmm", extname(id));
40+
if (extname(id) === ".po") {
41+
return basename(id);
42+
}
43+
// Keep everything else as is for now (single chunk)
44+
return "index";
45+
},
46+
},
3547
// Bundle only english words in bip39.
3648
external: /.*\/wordlists\/(?!english).*\.json/,
3749
},

0 commit comments

Comments
 (0)