描述
You are running the esm-bundler build of vue-i18n. It is recommended to configure your bundler to explicitly replace feature flag globals withboolean literals to get proper tree-shaking in the final bundle.
【解决 使用 vue-i18n 入口文件配置 控制台报警问题】vite.config.ts 文件中
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
export default defineConfig({
server: {
proxy: {
'/api': {
target: 'http://127.0.0.1:8000/api',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ''),
},
},
},
alias: {
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js',
},
plugins: [vue()],
});
关键配置
alias: {
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js',
},
文章图片