-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathbuild_sp.js
More file actions
29 lines (27 loc) · 825 Bytes
/
Copy pathbuild_sp.js
File metadata and controls
29 lines (27 loc) · 825 Bytes
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
// Bundle src/www/js/lib/_sp_entry.js → src/www/js/lib/sp.js using esbuild +
// node-polyfill. Run via `node build_sp.js`.
const esbuild = require('esbuild');
const { polyfillNode } = require('esbuild-plugin-polyfill-node');
esbuild.build({
entryPoints: ['src/www/js/lib/_sp_entry.js'],
bundle: true,
format: 'iife',
globalName: '__silentPaymentsBundle',
minify: true,
target: 'es2020',
outfile: 'src/www/js/lib/sp.js',
plugins: [
polyfillNode({
globals: { buffer: true, process: true },
polyfills: { crypto: true, stream: true, buffer: true, process: true, util: true, events: true, string_decoder: true, assert: true },
}),
],
define: {
'global': 'globalThis',
},
}).then(() => {
console.log('sp.js bundled');
}).catch((e) => {
console.error(e);
process.exit(1);
});