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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
3 import rollupResolve from "@rollup/plugin-node-resolve";
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
4 import rollupCommonjs from "@rollup/plugin-commonjs";
99
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
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
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
8 server: {
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
9 host: "0.0.0.0",
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
10 port: 8001,
140
2ad4784c0d6c update demo
drewp@bigasterisk.com
parents: 137
diff changeset
11 hmr: { port: 8002, path: "hmr", protocol: "ws" },
99
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
12 fs: {
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
13 allow: ["src", "node_modules", "."],
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
14 },
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
15 },
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
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
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
18 lib: {
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
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
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
22 },
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
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
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
26 rollupResolve({
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
27 browser: true,
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
28 preferBuiltins: false,
8a30f1c9a702 trying to build a runnable dist
drewp@bigasterisk.com
parents: 130
diff changeset
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
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
42 },
135
a6490559ce73 WIP trying to make a usable release module
drewp@bigasterisk.com
parents: 133
diff changeset
43 minify: false,
99
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
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
2ad4784c0d6c update demo
drewp@bigasterisk.com
parents: 137
diff changeset
48 define: {
2ad4784c0d6c update demo
drewp@bigasterisk.com
parents: 137
diff changeset
49 // global: {},
2ad4784c0d6c update demo
drewp@bigasterisk.com
parents: 137
diff changeset
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
faf7e432f089 WIP build setup
drewp@bigasterisk.com
parents:
diff changeset
62 });