2.8K Star 9.5K Fork 4K

GVP卓源软件/JeeSite

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.ts 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
卓源软件 提交于 2024-08-20 16:33 . 代码优化
/**
* Copyright (c) 2013-Now http://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 { readPackageJSON } from 'pkg-types';
import { resolve } from 'node:path';
import {
createBuildOptions,
createCSSOptions,
createDefineOptions,
createEsBuildOptions,
createServerOptions,
createVitePlugins,
wrapperEnv,
} from './build';
export default defineConfig(async ({ command, mode }: ConfigEnv) => {
const root = process.cwd();
const isBuild = command === 'build';
const viteEnv = wrapperEnv(loadEnv(mode, root));
const pkg = await readPackageJSON(root);
const pathResolve = (pathname: string) => resolve(root, '.', pathname);
const config: UserConfig = {
root,
base: viteEnv.VITE_PUBLIC_PATH,
define: createDefineOptions(pkg),
plugins: createVitePlugins(isBuild, viteEnv, pkg),
server: createServerOptions(viteEnv),
esbuild: createEsBuildOptions(mode),
build: createBuildOptions(viteEnv),
css: createCSSOptions(),
resolve: {
alias: {
'/@/': pathResolve('src') + '/',
'/#/': pathResolve('types') + '/',
},
},
};
return config;
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/thinkgem/jeesite.git
[email protected]:thinkgem/jeesite.git
thinkgem
jeesite
JeeSite
main

搜索帮助

0d507c66 1850385 C8b1a773 1850385