-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprod-build.ts
93 lines (88 loc) · 2.17 KB
/
prod-build.ts
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import {
clearFolders,
addDefaultIndex,
client,
postcssPlugin,
single,
minifyHTMLLiteralsPlugin,
copySync
} from "esbuild-helpers";
clearFolders("dist");
copySync("node_modules/web-ifc/web-ifc.wasm", "docs");
// helpers so ifcjs does not make esbuild think its nodejs only
const SkipPathAndFs = {
name: "skip-path-and-fs",
setup(build: any) {
const filter = /^(path)|(fs)/;
build.onResolve({ filter }, (args: any) => {
return { path: args.path, external: true };
});
}
};
/**
* css so we dont need to wait for postcss unless we change css..
*/
single(null, {
color: true,
define: {
DEVELOPMENT: "true"
},
entryPoints: ["./src/index.css"],
outfile: "./docs/index.css",
plugins: [
postcssPlugin([
// eslint-disable-next-line @typescript-eslint/no-var-requires
require("tailwindcss")({
purge: {
enabled: true,
content: ["./src/**/*.ts"]
}
})
])
],
logLevel: "error",
incremental: false
});
/**
* client bundle
*/
client(null, {
color: true,
define: {
DEVELOPMENT: "false",
// eslint-disable-next-line @typescript-eslint/no-var-requires
VERSION: `"${require("./package-lock.json").version}"`
},
entryPoints: ["./src/index.ts"],
outfile: "./docs/index.js",
plugins: [SkipPathAndFs],
minify: true,
bundle: true,
platform: "browser",
sourcemap: false,
logLevel: "error",
incremental: false
});
/**
* index file for project
*/
addDefaultIndex({
publicFolders: [],
hbr: false,
distFolder: "docs",
entry: "./index.js",
indexTemplate: /*html*/ `<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link href="./index.css" rel="stylesheet" />
<script src="./index.js"></script>
</head>
<body>
<app-root></app-root>
</body>
</html>
`
});