@@ -3,7 +3,7 @@ import { DEFAULT_RUNTIME, ResolvedConfig } from "@trigger.dev/core/v3/build";
33import { BuildManifest , BuildTarget , TaskFile } from "@trigger.dev/core/v3/schemas" ;
44import * as esbuild from "esbuild" ;
55import { createHash } from "node:crypto" ;
6- import { basename , dirname , join , relative , resolve } from "node:path" ;
6+ import { join , relative , resolve } from "node:path" ;
77import { createFile } from "../utilities/fileSystem.js" ;
88import { logger } from "../utilities/logger.js" ;
99import { resolveFileSources } from "../utilities/sourceFiles.js" ;
@@ -17,6 +17,7 @@ import {
1717 getRunWorkerForTarget ,
1818 isIndexControllerForTarget ,
1919 isIndexWorkerForTarget ,
20+ isInitEntryPoint ,
2021 isLoaderEntryPoint ,
2122 isRunControllerForTarget ,
2223 isRunWorkerForTarget ,
@@ -246,23 +247,6 @@ export async function getBundleResultFromBuild(
246247 ? relative ( resolvedConfig . workingDir , resolvedConfig . configFile )
247248 : "trigger.config.ts" ;
248249
249- // Check if the entry point is an init.ts file at the root of a trigger directory
250- function isInitEntryPoint ( entryPoint : string ) : boolean {
251- const initFileNames = [ "init.ts" , "init.mts" , "init.cts" , "init.js" , "init.mjs" , "init.cjs" ] ;
252-
253- // Check if it's directly in one of the trigger directories
254- return resolvedConfig . dirs . some ( ( dir ) => {
255- const normalizedDir = resolve ( dir ) ;
256- const normalizedEntryDir = resolve ( dirname ( entryPoint ) ) ;
257-
258- if ( normalizedDir !== normalizedEntryDir ) {
259- return false ;
260- }
261-
262- return initFileNames . includes ( basename ( entryPoint ) ) ;
263- } ) ;
264- }
265-
266250 for ( const [ outputPath , outputMeta ] of Object . entries ( result . metafile . outputs ) ) {
267251 if ( outputPath . endsWith ( ".mjs" ) ) {
268252 const $outputPath = resolve ( workingDir , outputPath ) ;
@@ -283,7 +267,7 @@ export async function getBundleResultFromBuild(
283267 indexControllerEntryPoint = $outputPath ;
284268 } else if ( isIndexWorkerForTarget ( outputMeta . entryPoint , target ) ) {
285269 indexWorkerEntryPoint = $outputPath ;
286- } else if ( isInitEntryPoint ( outputMeta . entryPoint ) ) {
270+ } else if ( isInitEntryPoint ( outputMeta . entryPoint , resolvedConfig . dirs ) ) {
287271 initEntryPoint = $outputPath ;
288272 } else {
289273 if (
0 commit comments