zipline/esbuild.config.js

24 lines
599 B
JavaScript
Raw Normal View History

const esbuild = require('esbuild');
2022-03-13 19:30:37 -07:00
const { existsSync } = require('fs');
const { rm } = require('fs/promises');
2022-10-23 12:16:59 -07:00
const { recursiveReadDir } = require('next/dist/lib/recursive-readdir');
(async () => {
2022-03-13 19:30:37 -07:00
if (existsSync('./dist')) {
await rm('./dist', { recursive: true });
}
2022-10-23 12:16:59 -07:00
const entryPoints = await recursiveReadDir('./src', /.*\.(ts)$/, /(themes|queries|pages)/);
await esbuild.build({
tsconfig: 'tsconfig.json',
outdir: 'dist',
platform: 'node',
2022-10-23 12:16:59 -07:00
entryPoints,
format: 'cjs',
resolveExtensions: ['.ts', '.js'],
write: true,
2022-07-28 11:03:22 -07:00
sourcemap: true,
});
})();