乐趣区

关于vue.js:解决-使用-vuei18n-入口文件配置-控制台报警问题

形容

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 文件中

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',},

退出移动版