forked from holy-unblocker/website-legacy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildConfig.js
More file actions
32 lines (27 loc) · 720 Bytes
/
buildConfig.js
File metadata and controls
32 lines (27 loc) · 720 Bytes
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
/*
* Build uv.config.js using esbuild
*/
import { expand } from 'dotenv-expand';
import { config } from 'dotenv-flow';
import { build } from 'esbuild';
process.env.NODE_ENV ??= process.argv.includes('--prod')
? 'production'
: 'development';
process.env.VITE_PUBLIC_PATH ??= '';
expand(config());
/**
* import.meta.env replacements for VITE_ env
*/
const defineEnv = Object.fromEntries(
Object.keys(process.env)
.filter((key) => key.startsWith('VITE_'))
.map((key) => [`import.meta.env.${key}`, JSON.stringify(process.env[key])]),
);
await build({
target: 'ES2020',
format: 'iife',
entryPoints: ['./config/uv/uv.config.ts'],
minify: true,
define: defineEnv,
outfile: './public/uv/uv.config.js',
});