Files
child-vue2-interview/vite.config.js
2026-06-21 00:05:19 +08:00

29 lines
858 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue2'
import path from 'node:path'
// import vueJsx from '@vitejs/plugin-vue2-jsx' // 如需 JSX
export default defineConfig({
plugins: [
vue(),
// vueJsx() // 开启 JSX 支持
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
// Vue2 完整构建ElementUI 等可能需要)
'vue$': 'vue/dist/vue.esm.js'
},
extensions: ['.js', '.vue', '.json']
},
server: {
port: 5173,
// micro-app 子应用跨域配置:允许主应用 fetch 子应用资源
cors: true,
headers: {
'Access-Control-Allow-Origin': '*',
},
},
// 生产环境 base 应与主应用 baseroute 对齐,需要时取消注释
// base: '/child-app/',
})