forked from aws/aws-lambda-nodejs-runtime-interface-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
49 lines (43 loc) · 1.02 KB
/
build.js
File metadata and controls
49 lines (43 loc) · 1.02 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
47
48
49
/**
* Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*/
'use strict';
const { build } = require('esbuild');
const fs = require('fs');
const shared = {
bundle: true,
entryPoints: ['index.mjs'],
external: ['./rapid-client.node'],
logLevel: 'info',
minify: false,
platform: 'node',
format: 'esm',
charset: 'utf8',
banner: {
js: `/** Copyright 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. */\nimport { createRequire } from \"module\";\nconst require = createRequire(import.meta.url);`,
},
};
const buildOneSet = (target) => {
build({
...shared,
outfile: `../dist/index.mjs`,
target,
});
// Keep backward compatibility for Node14
if (process.version.startsWith('v14')) {
build({
...shared,
format: 'cjs',
entryPoints: ['UserFunction.js'],
banner: {
js: '(function (){',
},
footer: {
js: '})();',
},
outfile: `../dist/UserFunction.js`,
target,
});
}
};
buildOneSet('node14.21.3');