-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.js
More file actions
65 lines (54 loc) · 1.17 KB
/
vite.config.js
File metadata and controls
65 lines (54 loc) · 1.17 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import {defineConfig , loadEnv} from 'vite'
import {execSync} from "child_process"
var _opt
export default defineConfig((opt) =>
{
console.log(opt)
_opt = opt
const env = loadEnv(opt.mode, process.cwd(), '');
const aliasConfig = {
resolve: {
alias: {
'parser': env.PARSER_LIB
}
}
};
if(opt.command == "serve" )
return { ...configExample, ...aliasConfig };
if(opt.command == "build")
return { ...configBuild, ...aliasConfig };
throw new Error("Mode not defined: use [build | dev]")
})
const configExample =
{
root:"./",
server:
{
open: "./examples/index.html",
host:"localhost.local",
allowedHosts:["localhost.local"],
port:5555,
},
}
const configBuild =
{
build:
{
outDir:"./build",
assetsDir:"",
emptyOutDir:false,
minify:"esbuild",
sourcemap: true,
rollupOptions:
{
input:
{
main: './src/index.js',
},
output:
{
entryFileNames:`nextpage-client.min.js`
}
}
}
}