Skip to content

Commit f43e3f7

Browse files
committed
import init file in managed worker
1 parent 39f0308 commit f43e3f7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

packages/cli-v3/src/entryPoints/managed-run-worker.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,18 @@ const zodIpc = new ZodIpcConnection({
324324
async () => {
325325
const beforeImport = performance.now();
326326
resourceCatalog.setCurrentFileContext(taskManifest.entryPoint, taskManifest.filePath);
327+
328+
// Load init file if it exists
329+
if (workerManifest.initEntryPoint) {
330+
try {
331+
await import(normalizeImportPath(workerManifest.initEntryPoint));
332+
console.log(`Loaded init file from ${workerManifest.initEntryPoint}`);
333+
} catch (err) {
334+
console.error(`Failed to load init file`, err);
335+
throw err;
336+
}
337+
}
338+
327339
await import(normalizeImportPath(taskManifest.entryPoint));
328340
resourceCatalog.clearCurrentFileContext();
329341
const durationMs = performance.now() - beforeImport;

0 commit comments

Comments
 (0)