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

36次阅读

共计 538 个字符,预计需要花费 2 分钟才能阅读完成。

形容

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

正文完
 0