-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.js
45 lines (39 loc) · 1.04 KB
/
build.js
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
const esbuild = require('esbuild');
const sassPlugin = require('esbuild-plugin-sass');
const fs = require('fs-extra');
const { platform } = require('os');
const sourcePath = 'src/app/index.html';
const destinationPath = 'dist/app/index.html';
esbuild.build({
entryPoints: ['src/main.ts'],
target: 'es2020',
platform: 'node',
outfile: 'dist/main.js',
bundle: true,
sourcemap: true,
packages: 'external',
}).then(() => fs.copySync(sourcePath, destinationPath)
).catch(e => (console.log(e), process.exit(1)));
esbuild.build({
entryPoints: ['src/preload.ts'],
target: 'es2020',
platform: 'node',
outfile: 'dist/preload.js',
bundle: true,
sourcemap: true,
packages: 'external',
}).catch(e => (console.log(e), process.exit(1)));
esbuild.build({
entryPoints: ['src/app/src/main.ts'],
bundle: true,
minify: true,
target: 'es2021',
outfile: 'dist/app/bundle.js',
loader: {
'.ts': 'ts',
'.js': 'js',
'.sass': 'css',
},
sourcemap: true,
plugins: [sassPlugin()],
}).catch(e => (console.log(e), process.exit(1)));