improve banner for esbuild bundle

This commit is contained in:
Ruben Fiszel
2024-07-30 21:23:31 +02:00
parent 716bb7118b
commit 72ff465300
+12
View File
@@ -161,6 +161,18 @@ export async function handleFile(
bundle: true,
write: false,
platform: "node",
packages: "bundle",
target: "node20.15.1",
banner: {
js: `
import { createRequire } from 'module';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
const require = createRequire(import.meta.url);
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);`,
},
});
bundleContent = out.outputFiles[0].text;
log.info(`Finished building the bundle for ${path}`);