Mercurial > code > home > repos > streamed-graph
annotate vite.config.ts @ 130:73a70d00fb74
dep upgrades; working on build+release setup
author | drewp@bigasterisk.com |
---|---|
date | Sat, 06 May 2023 13:11:19 -0700 |
parents | 76c1a29a328f |
children | 8a30f1c9a702 |
rev | line source |
---|---|
130
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
1 import { defineConfig, Plugin, UserConfigExport } from "vite"; |
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
2 import terser from "@rollup/plugin-terser"; |
99 | 3 |
101
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
4 const config: UserConfigExport = { |
99 | 5 base: "https://bigasterisk.com/reposyncDev/", |
6 server: { | |
7 host: "0.0.0.0", | |
8 port: 8001, | |
9 hmr: { port: 443 }, | |
10 fs: { | |
11 allow: ["src", "node_modules", "."], | |
12 }, | |
13 }, | |
14 build: { | |
101
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
15 target: "esnext", |
99 | 16 lib: { |
17 entry: "src/index.ts", | |
18 formats: ["es"], | |
19 }, | |
20 rollupOptions: { | |
21 external: /^lit/, | |
130
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
22 plugins: [ |
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
23 terser({ |
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
24 mangle:false, |
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
25 compress:false, |
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
26 format: { |
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
27 semicolons: false, |
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
28 }, |
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
29 }) as Plugin, |
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
30 ], |
99 | 31 }, |
130
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
32 minify: true, |
99 | 33 }, |
34 resolve: { | |
35 alias: [{ find: "rdf-canonize-native", replacement: "" }], | |
36 }, | |
37 define: { | |
101
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
38 global: {}, |
99 | 39 }, |
101
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
40 }; |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
41 |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
42 export default defineConfig(({ command, mode }) => { |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
43 if (command === "serve") { |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
44 (config.define as any)["process"] = { env: {} }; |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
45 return config; |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
46 } else if (command === "build") { |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
47 return config; |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
48 } else { |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
49 throw new Error(command); |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
50 } |
99 | 51 }); |