forked from LibertyDSNP/parquetjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
esbuild.js
47 lines (44 loc) · 1.26 KB
/
esbuild.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
const esbuild = require('esbuild')
const path = require("path")
const {compressionBrowserPlugin, wasmPlugin} = require("./esbuild-plugins");
// esbuild has TypeScript support by default
const baseConfig = {
bundle: true,
entryPoints: ['parquet.ts'],
define: {
"process.env.NODE_DEBUG": false,
"process.env.NODE_ENV": "\"production\"",
global: "window"
},
inject: ['./esbuild-shims.js'],
minify: true,
platform: 'browser', // default
plugins: [compressionBrowserPlugin, wasmPlugin],
target: "es2020" // default
};
const targets = [
{
...baseConfig,
globalName: 'parquetjs',
outdir: path.resolve(__dirname, "dist","browser"),
},
{
...baseConfig,
format: "esm",
outfile: path.resolve(__dirname, "dist","browser","parquet.esm.js"),
},
{
...baseConfig,
format: "cjs",
outfile: path.resolve(__dirname, "dist","browser","parquet.cjs.js"),
}
]
Promise.all(targets.map(esbuild.build))
.then(results => {
if (results.reduce((m,r)=>m && !r.warnings.length, true)) {
console.log("built with no errors or warnings")
}
})
.catch(e => {
console.error("Finished with errors: ", e.toString());
});