fix: split locale chunks by removing eager i18n glob

The eager `import.meta.glob` was statically pulling all 13 locale JSON
files into the main bundle, defeating the sibling lazy glob and emitting
INEFFECTIVE_DYNAMIC_IMPORT warnings. Statically import only the en-US
fallback, lazy-load the rest, and await `readyI18n()` in each entry
before mount so the first paint still uses the active locale.
This commit is contained in:
MHSanaei committed 2026-05-15 10:50:40 +02:00 Unverified
1 parent 19d50bd16c
commit 79a9be7b22
9 files changed
+51 -76

No files matched your search

+4 -2
View File
@@ -4,7 +4,7 @@ import 'ant-design-vue/dist/reset.css';
import { setupAxios } from '@/api/axios-init.js';
import '@/composables/useTheme.js';
import { i18n } from '@/i18n/index.js';
import { i18n, readyI18n } from '@/i18n/index.js';
import { applyDocumentTitle } from '@/utils';
import ApiDocsPage from '@/pages/api-docs/ApiDocsPage.vue';
@@ -16,4 +16,6 @@ if (messageContainer) {
message.config({ getContainer: () => messageContainer });
}
createApp(ApiDocsPage).use(Antd).use(i18n).mount('#app');
readyI18n().then(() => {
createApp(ApiDocsPage).use(Antd).use(i18n).mount('#app');
});
+4 -2
View File
@@ -4,7 +4,7 @@ import 'ant-design-vue/dist/reset.css';
import { setupAxios } from '@/api/axios-init.js';
import '@/composables/useTheme.js';
import { i18n } from '@/i18n/index.js';
import { i18n, readyI18n } from '@/i18n/index.js';
import { applyDocumentTitle } from '@/utils';
import InboundsPage from '@/pages/inbounds/InboundsPage.vue';
@@ -16,4 +16,6 @@ if (messageContainer) {
message.config({ getContainer: () => messageContainer });
}
createApp(InboundsPage).use(Antd).use(i18n).mount('#app');
readyI18n().then(() => {
createApp(InboundsPage).use(Antd).use(i18n).mount('#app');
});
+4 -2
View File
@@ -6,7 +6,7 @@ import { setupAxios } from '@/api/axios-init.js';
// Importing useTheme triggers the boot side-effect that applies the
// stored theme to <body>/<html> before Vue mounts.
import '@/composables/useTheme.js';
import { i18n } from '@/i18n/index.js';
import { i18n, readyI18n } from '@/i18n/index.js';
import { applyDocumentTitle } from '@/utils';
import IndexPage from '@/pages/index/IndexPage.vue';
@@ -18,4 +18,6 @@ if (messageContainer) {
message.config({ getContainer: () => messageContainer });
}
createApp(IndexPage).use(Antd).use(i18n).mount('#app');
readyI18n().then(() => {
createApp(IndexPage).use(Antd).use(i18n).mount('#app');
});
Loaded 3 of 9 files, more files were not shown because too many files have changed in this diff. Show more