Skip to content

Commit 6ada9ba

Browse files
committed
fix path normalization for init.ts
1 parent e43abd8 commit 6ada9ba

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

packages/cli-v3/src/build/bundle.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { DEFAULT_RUNTIME, ResolvedConfig } from "@trigger.dev/core/v3/build";
33
import { BuildManifest, BuildTarget, TaskFile } from "@trigger.dev/core/v3/schemas";
44
import * as esbuild from "esbuild";
55
import { createHash } from "node:crypto";
6-
import { join, relative, resolve } from "node:path";
6+
import { basename, dirname, join, relative, resolve } from "node:path";
77
import { createFile } from "../utilities/fileSystem.js";
88
import { logger } from "../utilities/logger.js";
99
import { resolveFileSources } from "../utilities/sourceFiles.js";
@@ -239,15 +239,18 @@ export async function getBundleResultFromBuild(
239239

240240
// Check if the entry point is an init.ts file at the root of a trigger directory
241241
function isInitEntryPoint(entryPoint: string): boolean {
242-
const normalizedEntryPoint = entryPoint.replace(/\\/g, "/"); // Normalize path separators
243242
const initFileNames = ["init.ts", "init.mts", "init.cts", "init.js", "init.mjs", "init.cjs"];
244243

245244
// Check if it's directly in one of the trigger directories
246245
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));
251254
});
252255
}
253256

0 commit comments

Comments
 (0)