This repository has been archived by the owner on Oct 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.ts
54 lines (51 loc) · 1.36 KB
/
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
import { build } from 'esbuild';
import { nodeBuiltIns } from 'esbuild-node-builtins';
const runBuild = async () => {
// Build to browser js
build({
plugins: [nodeBuiltIns()],
entryPoints: ['./src/blockweave.ts'],
minify: false,
bundle: true,
platform: 'browser',
target: ['es2019'],
outfile: './dist/blockweave-web.js',
sourcemap: 'external',
define: {
'process.env.NODE_DEBUG': 'false',
'process.env.NODE_ENV': 'production',
'process.env.DEBUG': 'false',
'global': 'window',
'process.cwd': 'String',
'_smartweave_1.LoggerFactory.INST': '{"create": "function() {}"}',
'__filename': 'String',
}
}).catch((e) => {
console.log(e);
process.exit(1);
});
// Minified version
build({
plugins: [nodeBuiltIns()],
entryPoints: ['./src/blockweave.ts'],
minify: true,
bundle: true,
platform: 'browser',
target: ['es2019'],
outfile: './dist/blockweave-web.min.js',
sourcemap: 'external',
define: {
'process.env.NODE_DEBUG': 'false',
'process.env.NODE_ENV': 'production',
'process.env.DEBUG': 'false',
'global': 'window',
'process.cwd': 'String',
'_smartweave_1.LoggerFactory.INST': '{"create": "function() {}"}',
'__filename': 'String',
}
}).catch((e) => {
console.log(e);
process.exit(1)
});
};
runBuild();