-
Notifications
You must be signed in to change notification settings - Fork 40
Expand file tree
/
Copy pathbuild.mjs
More file actions
49 lines (45 loc) · 1.2 KB
/
build.mjs
File metadata and controls
49 lines (45 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// vite.config.js
import { resolve } from "path";
import { build, defineConfig } from "vite";
import dts from "vite-plugin-dts";
const libConfig = defineConfig({
build: {
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(import.meta.dirname, "src/webglplot.ts"),
name: "webglplot",
// the proper extensions will be added
fileName: "webglplot",
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: [],
output: {
// Provide global variables to use in the UMD build
// for externalized deps
globals: {},
},
},
},
plugins: [dts({ rollupTypes: true })],
});
const benchmarkConfig = defineConfig({
root: resolve(import.meta.dirname, "benchmark"),
build: {
outDir: resolve(import.meta.dirname, "dist-benchmark"),
emptyOutDir: true,
rollupOptions: {
input: {
main: resolve(import.meta.dirname, "benchmark", "bench-thick.html"),
},
},
},
});
async function runBuilds() {
// Build the library
await build(libConfig);
// Build the benchmarks
await build(benchmarkConfig);
}
runBuilds();