Vue i18n Advanced Optimization
See original GitHub issueHello, i just use this template and run it.
I can see a warning message in console.
vue-i18n.esm-bundler.js:46
You are running the esm-bundler build of vue-i18n. It is recommended to configure your bundler to explicitly replace feature flag globals with boolean literals to get proper tree-shaking in the final bundle.
Of course, we can turn off the warning like this.
// vite.config.ts
export default defineConfig({
resolve: {
alias: {
"vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js",
},
},
})
Do we need set boolean literals
to replace feature flag globals
? (Sorry, i can not understand what do we need to do.)
In addition, I read the documentation of vue-i18n.
Improve performance and reduce bundle size with runtime build only
Should we add it as part of the vite template?
export default defineConfig({
// ...
alias: {
'vue-i18n': 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js'
},
})
If you need, I can create a PR for it.
Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (1 by maintainers)
Top Results From Across the Web
Optimization - Vue I18n - Intlify
The use of this ES Module means that all locale messages have to pre-compile to Message functions. what this means it improves performance ......
Read more >https://github.com/intlify/vue-i18n-next/edit/mast...
No information is available for this page.
Read more >Performance optimization of vue-i18n - Medium
vue -i18n provides a compiler module that enables pre-translation of custom directive v-t , using the compilation hooking mechanism provided with ...
Read more >Localization in Vue.js with vue-i18n - LogRocket Blog
The advanced localization techniques you can implement with Vue.js will help your web application reach a wider global audience.
Read more >You are running the esm-bundler build of vue-i18n. It is ...
Now i am using this way to import the i18n, the warning is disapear import { createI18n } from 'vue-i18n/index'.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just add these 2 options on
VueI18n
plugin, the plugin will change the module for you and so you don’t have to map/resolve its internals:@YunYouJun only on buid and runtimeOnly flag to true: https://github.com/intlify/bundle-tools/blob/main/packages/vite-plugin-vue-i18n/src/index.ts#L66