Mercurial > code > home > repos > streamed-graph
annotate vite.config.ts @ 148:c26538ee1d1d
minify build, rm dead deps
author | drewp@bigasterisk.com |
---|---|
date | Mon, 08 May 2023 14:04:50 -0700 |
parents | 2ad4784c0d6c |
children | 3ce355e4f388 |
rev | line source |
---|---|
148 | 1 import rollupResolve from "@rollup/plugin-node-resolve"; |
130
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
2 import terser from "@rollup/plugin-terser"; |
148 | 3 import { defineConfig, UserConfigExport } from "vite"; |
99 | 4 |
101
76c1a29a328f
repo now demos itself, which runs better than using the nested demo/ project
drewp@bigasterisk.com
parents:
99
diff
changeset
|
5 const config: UserConfigExport = { |
99 | 6 server: { |
7 host: "0.0.0.0", | |
8 port: 8001, | |
140 | 9 hmr: { port: 8002, path: "hmr", protocol: "ws" }, |
99 | 10 fs: { |
11 allow: ["src", "node_modules", "."], | |
12 }, | |
13 }, | |
14 build: { | |
15 lib: { | |
16 entry: "src/index.ts", | |
148 | 17 formats: ["iife"], |
135
a6490559ce73
WIP trying to make a usable release module
drewp@bigasterisk.com
parents:
133
diff
changeset
|
18 name: "streamedgraph", |
99 | 19 }, |
148 | 20 minify: false, |
99 | 21 rollupOptions: { |
130
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
22 plugins: [ |
133 | 23 rollupResolve({ |
24 browser: true, | |
25 preferBuiltins: false, | |
26 }), | |
148 | 27 terser({ |
28 mangle: true, | |
29 compress: false, | |
30 format: { | |
31 semicolons: false, | |
32 }, | |
33 }), | |
130
73a70d00fb74
dep upgrades; working on build+release setup
drewp@bigasterisk.com
parents:
101
diff
changeset
|
34 ], |
99 | 35 }, |
148 | 36 sourcemap: true, |
37 target: "esnext", | |
99 | 38 }, |
148 | 39 define: {}, |
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 }); |