-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathesbuild.assets.js
More file actions
46 lines (41 loc) · 1.19 KB
/
Copy pathesbuild.assets.js
File metadata and controls
46 lines (41 loc) · 1.19 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
const esbuild = require('esbuild');
const isWatch = process.argv.includes('--watch');
/** @type {import("esbuild").BuildOptions[]} */
const builds = [
{
logLevel: 'info',
bundle: true,
minify: true,
sourcemap: 'linked',
legalComments: 'linked',
target: 'es2020',
entryPoints: {
Backend: './Resources/Private/Assets/Backend.ts',
AsyncForm: './Resources/Private/Assets/AsyncForm.ts',
Altcha: './Resources/Private/Assets/Altcha.ts'
},
outdir: './Resources/Public/Scripts'
},
{
logLevel: 'info',
bundle: true,
minify: true,
sourcemap: false,
entryPoints: {
Backend: './Resources/Private/Assets/Backend.css'
},
outdir: './Resources/Public/Styles'
}
];
async function run() {
if (isWatch) {
const contexts = await Promise.all(builds.map((options) => esbuild.context(options)));
await Promise.all(contexts.map((ctx) => ctx.watch()));
return;
}
await Promise.all(builds.map((options) => esbuild.build(options)));
}
run().catch((error) => {
console.error(error);
process.exit(1);
});