Mercurial > code > home > repos > streamed-graph
annotate vite.config.ts @ 139:cf642d395be4
new simpler Patch class; fancier 'hide' view config support
author | drewp@bigasterisk.com |
---|---|
date | Mon, 08 May 2023 13:05:20 -0700 |
parents | a8939c717015 |
children | 2ad4784c0d6c |
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, | |
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", | |
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, | |
137
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
29 |
133 | 30 }), |
137
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
31 // rollupCommonjs(), |
135
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
32 // terser({ |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
33 // mangle: false, |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
34 // compress: false, |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
35 // format: { |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
36 // semicolons: false, |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
37 // }, |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
38 // }), |
137
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
39 // rollupAlias({ |
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
40 // 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
|
41 // }), |
130
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
42 ], |
99 | 43 }, |
135
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
44 minify: false, |
99 | 45 }, |
137
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
46 // resolve: { |
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
47 // 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
|
48 // }, |
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
49 // define: { |
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
50 // global: {}, |
a8939c717015
still trying to get build right, but there are other update bugs too
drewp@bigasterisk.com
parents:
135
diff
changeset
|
51 // }, |
101
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 |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
54 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
|
55 if (command === "serve") { |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
56 (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
|
57 return config; |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
58 } 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
|
59 return config; |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
60 } else { |
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
61 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
|
62 } |
99 | 63 }); |