Skip to content

Commit 1a073ff

Browse files
committed
clean up node module loader patch
1 parent f1cc83c commit 1a073ff

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

packages/cloudflare/src/cli/build/patches/plugins/node-module-loader.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,15 @@ async function getRule(buildOpts: BuildOptions) {
3333
pagesManifests = Object.values(JSON.parse(await readFile(pagesManifestFile, "utf-8")));
3434
} catch {
3535
// The file does not exist
36-
pagesManifests = [];
3736
}
3837

39-
const manifests = pagesManifests.map((path) => normalizePath(path));
40-
41-
const files = manifests.filter((file) => file.endsWith(".js"));
38+
const files = pagesManifests.filter((file) => file.endsWith(".js")).map(normalizePath);
4239

4340
// Inline fs access and dynamic requires that are not supported by workerd.
4441
const fnBody = `
4542
${files
4643
.map(
47-
(file) => `if (id.endsWith("${file}")) {
44+
(file) => `if ($ID.endsWith("${file}")) {
4845
return require(${JSON.stringify(join(serverDir, file))});
4946
}`
5047
)

0 commit comments

Comments
 (0)