/* eslint-disable n/no-unpublished-import */
import { env } from 'node:process';
+import chalk from 'chalk';
import { build } from 'esbuild';
import { clean } from 'esbuild-plugin-clean';
import { copy } from 'esbuild-plugin-copy';
const sourcemap = !!isDevelopmentBuild;
(async () => {
+ console.info(
+ chalk.green(`Building in ${isDevelopmentBuild ? 'development' : 'production'} mode`),
+ );
+ console.time('Build time');
await build({
entryPoints: ['./src/start.ts', './src/charging-station/ChargingStationWorker.ts'],
bundle: true,
platform: 'node',
format: 'esm',
- external: ['@mikro-orm/*'],
+ external: [
+ '@mikro-orm/*',
+ 'ajv',
+ 'ajv-formats',
+ 'basic-ftp',
+ 'chalk',
+ 'date-fns',
+ 'http-status-codes',
+ 'just-merge',
+ 'logform',
+ 'mnemonist/*',
+ 'mongodb',
+ 'node:*',
+ 'poolifier',
+ 'tar',
+ 'winston',
+ 'winston/*',
+ 'winston-daily-rotate-file',
+ 'ws',
+ ],
minify: true,
sourcemap,
+ entryNames: '[name]',
outdir: './dist',
plugins: [
clean({
}),
],
});
+ console.timeEnd('Build time');
})();