Mercurial > code > home > repos > streamed-graph
annotate vite.config.ts @ 140:2ad4784c0d6c
update demo
author | drewp@bigasterisk.com |
---|---|
date | Mon, 08 May 2023 13:05:48 -0700 |
parents | a8939c717015 |
children | c26538ee1d1d |
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 |
137
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
6 import rollupAlias from "@rollup/plugin-alias"; |
101
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
7 const config: UserConfigExport = { |
99 | 8 server: { |
9 host: "0.0.0.0", | |
10 port: 8001, | |
140 | 11 hmr: { port: 8002, path: "hmr", protocol: "ws" }, |
99 | 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", | |
135
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
20 formats: ["es", "cjs", "iife"], |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
21 name: "streamedgraph", |
99 | 22 }, |
23 rollupOptions: { | |
135
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
24 // external: /^lit/, |
130
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
25 plugins: [ |
133 | 26 rollupResolve({ |
27 browser: true, | |
28 preferBuiltins: false, | |
29 }), | |
137
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
30 // rollupCommonjs(), |
135
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
31 // terser({ |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
32 // mangle: false, |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
33 // compress: false, |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
34 // format: { |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
35 // semicolons: false, |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
36 // }, |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
37 // }), |
137
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
38 // rollupAlias({ |
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
39 // entries: [{ find: "promises", replacement: "__my_promises__" }], |
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
40 // }), |
130
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
41 ], |
99 | 42 }, |
135
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
43 minify: false, |
99 | 44 }, |
137
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
45 // resolve: { |
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
46 // alias: [{ find: "rdf-canonize-native", replacement: "" }], |
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
47 // }, |
140 | 48 define: { |
49 // global: {}, | |
50 }, | |
101
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
51 }; |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
52 |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
53 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
|
54 if (command === "serve") { |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
55 (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
|
56 return config; |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
57 } 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
|
58 return config; |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
59 } else { |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
60 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
|
61 } |
99 | 62 }); |