52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import path from 'node:path';
 | |
| 
 | |
| import { defineConfig, loadEnv } from '@farmfe/core';
 | |
| import less from '@farmfe/js-plugin-less';
 | |
| import vue from '@vitejs/plugin-vue';
 | |
| import vueJsx from '@vitejs/plugin-vue-jsx';
 | |
| import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
 | |
| import Components from 'unplugin-vue-components/vite';
 | |
| import mkcert from 'vite-plugin-mkcert';
 | |
| import qiankun from 'vite-plugin-qiankun';
 | |
| 
 | |
| export default defineConfig(({ mode }) => {
 | |
|   const env = loadEnv(mode, process.cwd(), ['VITE_']);
 | |
|   const isDev = env.VITE_NODE_ENV === 'development';
 | |
|   return {
 | |
|     plugins: [less()],
 | |
|     vitePlugins: [
 | |
|       vue(),
 | |
|       vueJsx(),
 | |
|       isDev && mkcert(),
 | |
|       qiankun('y-code-app', {
 | |
|         useDevMode: isDev,
 | |
|       }) as any,
 | |
|       Components({
 | |
|         resolvers: [
 | |
|           AntDesignVueResolver({
 | |
|             importStyle: 'less',
 | |
|           }),
 | |
|         ],
 | |
|       }),
 | |
|     ],
 | |
|     server: isDev
 | |
|       ? {
 | |
|           cors: true,
 | |
|           port: Number(env.VITE_PORT),
 | |
|         }
 | |
|       : undefined,
 | |
| 
 | |
|     compilation: {
 | |
|       resolve: {
 | |
|         alias: {
 | |
|           '@': path.resolve(__dirname, './src'),
 | |
|         },
 | |
|       },
 | |
|       // output: {
 | |
|       //   path: path.resolve(process.cwd(), "../../dist/y-code-v1"),
 | |
|       //   clean: true,
 | |
|       // },
 | |
|     },
 | |
|   };
 | |
| });
 | 
