likes
comments
collection
share

解决 使用 vue-i18n 入口文件配置 控制台报警问题

作者站长头像
站长
· 阅读数 286

描述

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

解决 使用 vue-i18n 入口文件配置 控制台报警问题