vue3项目启动之后,会提示如下警告
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.
解决方案
在vite.config.ts
或者vite.config.js
中添加一行
resolve: {
// https://cn.vitejs.dev/config/#resolve-alias
alias: {
"vue-i18n": "vue-i18n/dist/vue-i18n.cjs.js",
},
},