mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-24 16:01:42 +00:00
fix: for codebase bundle, use cjs exports instead
This commit is contained in:
@@ -718,7 +718,7 @@ pub async fn handle_bun_job(
|
||||
|
||||
if !codebase.is_some() && !has_bundle_cache {
|
||||
let _ = write_file(job_dir, "main.ts", inner_content).await?;
|
||||
} else if !annotation.native_mode {
|
||||
} else if !annotation.native_mode && codebase.is_none() {
|
||||
let _ = write_file(job_dir, "package.json", r#"{ "type": "module" }"#).await?;
|
||||
};
|
||||
|
||||
|
||||
+1
-11
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user