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