-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.js
More file actions
44 lines (38 loc) · 1.23 KB
/
build.js
File metadata and controls
44 lines (38 loc) · 1.23 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
const { build } = require("esbuild");
const servor = require("servor");
const watch = true; // The command used to be "!!process.env.WATCH", but Windows users had an error;
const outDir = './target/classes/static/js';
if (watch) {
console.log("\nKeep this program running while you work in your IDE (It rebuilds the JS files automatically)");
console.log("Press Ctrl+C to stop\n");
}
build({
entryPoints: [
'./src/main/resources/static/js/app.js',
'./src/main/resources/static/js/traceability-matrix-react.js',
'./src/main/resources/static/js/traceability-matrix-vanilla.js',
'./src/main/resources/static/js/page-adf-comparison.js'
],
outdir: outDir,
loader: { '.js': 'jsx' },
minify: false,
bundle: true,
sourcemap: true,
watch: watch,
// This is a gross hacking because @atlaskit/next-analytics tries to access the variable 'process' which is undefined.
// I'd hope it's temporary.
define: {
"process": JSON.stringify({
env: {
NODE_ENV: "production"
}
})
},
platform: "browser"
}).then(async () => {
watch && await servor({
browser: true,
root: outDir,
port: 8090,
});
});