zipline/esbuild.config.js

24 lines
599 B
JavaScript
Raw Normal View History

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