Skip to content

Commit 6d5d10a

Browse files
committed
Support other init file names
1 parent 1def8d0 commit 6d5d10a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,14 @@ export async function getBundleResultFromBuild(
239239
// Check if the entry point is an init.ts file at the root of a trigger directory
240240
function isInitEntryPoint(entryPoint: string): boolean {
241241
const normalizedEntryPoint = entryPoint.replace(/\\/g, "/"); // Normalize path separators
242-
const initFileName = "init.ts";
242+
const initFileNames = ["init.ts", "init.mts", "init.cts", "init.js", "init.mjs", "init.cjs"];
243243

244244
// Check if it's directly in one of the trigger directories
245245
return resolvedConfig.dirs.some((dir) => {
246246
const normalizedDir = dir.replace(/\\/g, "/");
247-
return normalizedEntryPoint === `${normalizedDir}/${initFileName}`;
247+
return initFileNames.some(
248+
(fileName) => normalizedEntryPoint === `${normalizedDir}/${fileName}`
249+
);
248250
});
249251
}
250252

0 commit comments

Comments
 (0)