@@ -3,7 +3,7 @@ import { DEFAULT_RUNTIME, ResolvedConfig } from "@trigger.dev/core/v3/build";
3
3
import { BuildManifest , BuildTarget , TaskFile } from "@trigger.dev/core/v3/schemas" ;
4
4
import * as esbuild from "esbuild" ;
5
5
import { createHash } from "node:crypto" ;
6
- import { join , relative , resolve } from "node:path" ;
6
+ import { basename , dirname , join , relative , resolve } from "node:path" ;
7
7
import { createFile } from "../utilities/fileSystem.js" ;
8
8
import { logger } from "../utilities/logger.js" ;
9
9
import { resolveFileSources } from "../utilities/sourceFiles.js" ;
@@ -239,15 +239,18 @@ export async function getBundleResultFromBuild(
239
239
240
240
// Check if the entry point is an init.ts file at the root of a trigger directory
241
241
function isInitEntryPoint ( entryPoint : string ) : boolean {
242
- const normalizedEntryPoint = entryPoint . replace ( / \\ / g, "/" ) ; // Normalize path separators
243
242
const initFileNames = [ "init.ts" , "init.mts" , "init.cts" , "init.js" , "init.mjs" , "init.cjs" ] ;
244
243
245
244
// Check if it's directly in one of the trigger directories
246
245
return resolvedConfig . dirs . some ( ( dir ) => {
247
- const normalizedDir = dir . replace ( / \\ / g, "/" ) ;
248
- return initFileNames . some (
249
- ( fileName ) => normalizedEntryPoint === `${ normalizedDir } /${ fileName } `
250
- ) ;
246
+ const normalizedDir = resolve ( dir ) ;
247
+ const normalizedEntryDir = resolve ( dirname ( entryPoint ) ) ;
248
+
249
+ if ( normalizedDir !== normalizedEntryDir ) {
250
+ return false ;
251
+ }
252
+
253
+ return initFileNames . includes ( basename ( entryPoint ) ) ;
251
254
} ) ;
252
255
}
253
256
0 commit comments