技术栈:Vue3+TypeScript+Vite+vue-i18n

开发环境下控制台告警
You are running the esm-bundler build of vue-i18n.

vue-i18n.esm-bundler.js:39 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.

翻译:你正在运行vue-i18n的esm-bundler构建。建议配置您的bundle,显式地用布尔值字面量替换特性标志全局变量,以便在最终的bundle中获得正确的树摇。

解决方案1:

vite.config.js 内配置 define: {VUE_I18N_FULL_INSTALL: true, VUE_I18N_LEGACY_API: true, INTLIFY_PROD_DEVTOOLS: false}
VUE_I18N_FULL_INSTALL

解决方案2:

vite.config.js 内配置 ‘vue-i18n’: ‘vue-i18n/dist/vue-i18n.cjs.js’,
vue-i18n/dist/vue-i18n.cjs.js

Logo

前往低代码交流专区

更多推荐