forked from archethic-foundation/libjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
executable file
·58 lines (53 loc) · 1.3 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
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env node
import esbuild from "esbuild"
esbuild.build({
logLevel: "info",
entryPoints: ['index.js'],
bundle: true,
minify: true,
sourcemap: true,
outfile: 'dist/archethic.js',
platform: 'browser',
define: {
global: 'window'
},
globalName: "archethic",
inject: ['./esbuild.inject.js'],
footer: {
js: "Archethic = archethic.default; Archethic.Utils = archethic.Utils; Archethic.Crypto = archethic.Crypto;"
}
}).catch(() => process.exit(1))
esbuild.build({
logLevel: "info",
entryPoints: ['index.js'],
bundle: true,
minify: true,
sourcemap: true,
outfile: 'dist/archethic.cjs',
inject: ['./esbuild.inject.js'],
platform: 'node'
}).catch(() => process.exit(1))
esbuild.build({
logLevel: "info",
entryPoints: ['index.js'],
bundle: true,
minify: true,
sourcemap: true,
outfile: 'dist/archethic-browser.mjs',
inject: ['./esbuild.inject.js'],
format: 'esm'
}).catch(() => process.exit(1))
esbuild.build({
logLevel: "info",
entryPoints: ['index.js'],
bundle: true,
minify: true,
sourcemap: true,
outfile: 'dist/archethic-node.mjs',
inject: ['./esbuild.inject.js'],
format: 'esm',
platform: "node",
banner: {
js: "import { createRequire } from 'module';const require = createRequire(import.meta.url);"
},
}).catch(() => process.exit(1))