| 123456789101112131415161718192021222324252627282930313233343536373839 |
- /**
- * Copyright (c) 2013-Now https://jeesite.com All rights reserved.
- * No deletion without permission, or be held responsible to law.
- * @author ThinkGem
- */
- import type { UserConfig, ConfigEnv } from 'vite';
- import { defineConfig, loadEnv } from 'vite';
- import path from 'path';
- import {
- createBuildOptions,
- createCSSOptions,
- createDefineOptions,
- createEsBuildOptions,
- createServerOptions,
- createVitePlugins,
- wrapperEnv,
- } from '@jeesite/vite';
- export default defineConfig(async ({ command, mode }: ConfigEnv) => {
- const root = process.cwd();
- const isBuild = command === 'build';
- const viteEnv = wrapperEnv(loadEnv(mode, root));
- const config: UserConfig = {
- root,
- base: viteEnv.VITE_PUBLIC_PATH,
- define: await createDefineOptions(),
- plugins: createVitePlugins(isBuild, viteEnv),
- server: createServerOptions(viteEnv),
- esbuild: createEsBuildOptions(viteEnv),
- build: createBuildOptions(viteEnv),
- css: createCSSOptions(),
- resolve: {
- alias: {
- '@jeesite/web': path.resolve(__dirname, './'),
- },
- },
- };
- return config;
- });
|