Mercurial > code > home > repos > streamed-graph
annotate vite.config.ts @ 135:a6490559ce73
WIP trying to make a usable release module
author | drewp@bigasterisk.com |
---|---|
date | Sat, 06 May 2023 14:16:01 -0700 |
parents | 8a30f1c9a702 |
children | a8939c717015 |
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 server: { |
8 host: "0.0.0.0", | |
9 port: 8001, | |
10 hmr: { port: 443 }, | |
11 fs: { | |
12 allow: ["src", "node_modules", "."], | |
13 }, | |
14 }, | |
15 build: { | |
101
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
16 target: "esnext", |
99 | 17 lib: { |
18 entry: "src/index.ts", | |
135
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
19 formats: ["es", "cjs", "iife"], |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
20 name: "streamedgraph", |
99 | 21 }, |
22 rollupOptions: { | |
135
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
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(), | |
135
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
30 // terser({ |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
31 // mangle: false, |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
32 // compress: false, |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
33 // format: { |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
34 // semicolons: false, |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
35 // }, |
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
36 // }), |
130
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
37 ], |
99 | 38 }, |
135
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
39 minify: false, |
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 }); |