litian
2 天以前 8bb0a518dd4d9450370582c4d4ac3ae1dba1466b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { fileURLToPath, URL } from 'node:url'
 
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx';
import electron from 'vite-plugin-electron'
 
// https://vitejs.dev/config/
export default defineConfig({
  base:"./",
  plugins: [
    vueJsx(),
    vue({
      template: {
        compilerOptions: {
          isCustomElement: (tag) => tag.includes('math-field')
        }
      }
    }),
    // electron({
    //   // 配置 Electron 入口文件
    //   entry: 'electron-commonJS/main.js'
    // }), 
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
    host: true,
    port: 8005,
    strictPort: true,
    cors: true, // 允许跨域
    hmr: true,
    headers: {
      "access-control-allow-origin": "*", // 允许跨域访问子应用页面
    },
  },
  define: {
    'process.env': process.env
  },
  css: {
    preprocessorOptions: {
      less: {
        charset: false,
        additionalData: '@import "./src/assets/style/global.less";'
      }
    }
  },
})