forked from ZJONSSON/parquetjs
-
Notifications
You must be signed in to change notification settings - Fork 25
/
esbuild-serve.mjs
31 lines (31 loc) · 985 Bytes
/
esbuild-serve.mjs
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
/**
* Use this to serve the parquetjs bundle at http://localhost:8000/main.js
* It attaches the parquet.js exports to a "parquetjs" global variable.
* See the example server for how to use it.
*/
import { compressionBrowserPlugin } from './esbuild-plugins.mjs';
import watPlugin from 'esbuild-plugin-wat';
import esbuild from 'esbuild';
// esbuild has TypeScript support by default. It will use .tsconfig
esbuild
.context({
entryPoints: ['parquet.ts'],
outfile: 'main.js',
define: { 'process.env.NODE_DEBUG': 'false', 'process.env.NODE_ENV': '"production"', global: 'window' },
platform: 'browser',
plugins: [compressionBrowserPlugin, watPlugin()],
sourcemap: 'external',
bundle: true,
minify: false,
globalName: 'parquetjs',
inject: ['./esbuild-shims.mjs'],
})
.then((context) => {
context
.serve({
servedir: './',
})
.then((server) => {
console.log('serving parquetjs', server);
});
});