chore: 框架构建流程调整
This commit is contained in:
55
apps/renderer/vite.config.ts
Normal file
55
apps/renderer/vite.config.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import path from 'node:path';
|
||||
|
||||
import vue from '@vitejs/plugin-vue';
|
||||
import { defineConfig, loadEnv } from 'vite';
|
||||
import mkcert from 'vite-plugin-mkcert';
|
||||
|
||||
export default defineConfig(({ mode }) => {
|
||||
console.log('mode', mode);
|
||||
const env = loadEnv(mode, process.cwd(), ['VITE_']);
|
||||
const isDev = env.VITE_NODE_ENV === 'development';
|
||||
|
||||
return {
|
||||
// 服务器配置
|
||||
server: isDev
|
||||
? {
|
||||
port: Number(env.VITE_PORT),
|
||||
cors: true,
|
||||
https: true, // mkcert 需要 https
|
||||
}
|
||||
: undefined,
|
||||
|
||||
// 插件配置
|
||||
plugins: [vue(), mkcert({ source: 'coding' })],
|
||||
|
||||
// 解析配置
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(process.cwd(), 'src'),
|
||||
$vtj: path.resolve(process.cwd(), '.vtj'),
|
||||
},
|
||||
},
|
||||
|
||||
// 定义全局变量
|
||||
define: {
|
||||
'process.env': JSON.stringify(env),
|
||||
},
|
||||
|
||||
// 构建配置
|
||||
build: {
|
||||
// outDir: path.resolve(process.cwd(), "../../dist/renderer"),
|
||||
// emptyOutDir: true,
|
||||
target: 'es2022',
|
||||
},
|
||||
|
||||
// 优化依赖
|
||||
optimizeDeps: {
|
||||
include: [],
|
||||
},
|
||||
|
||||
// CSS 配置
|
||||
css: {
|
||||
// 预处理器配置
|
||||
},
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user