fix: for codebase bundle, use cjs exports instead

This commit is contained in:
Ruben Fiszel
2024-07-30 21:48:40 +02:00
parent 1a548f32a1
commit be8cedfe7f
2 changed files with 2 additions and 12 deletions
+1 -11
View File
@@ -157,22 +157,12 @@ export async function handleFile(
log.info(`Starting building the bundle for ${path}`);
const out = await esbuild.build({
entryPoints: [path],
format: "esm",
format: "cjs",
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}`);