Skip to content

Commit 4a30231

Browse files
committed
fix node module loader rule and add changeset
1 parent 6afac13 commit 4a30231

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

.changeset/strange-laws-hang.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
fix pages api routes
6+
7+
fixed pages api routes by inlining a dynamic require in the `NodeModuleLoader` class

packages/cloudflare/src/cli/build/bundle-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ import { patchWebpackRuntime } from "./patches/ast/webpack-runtime.js";
1111
import * as patches from "./patches/index.js";
1212
import { inlineBuildId } from "./patches/plugins/build-id.js";
1313
import { ContentUpdater } from "./patches/plugins/content-updater.js";
14+
import { inlineDynamicRequires } from "./patches/plugins/dynamic-requires.js";
1415
import { inlineEvalManifest } from "./patches/plugins/eval-manifest.js";
1516
import { patchFetchCacheSetMissingWaitUntil } from "./patches/plugins/fetch-cache-wait-until.js";
1617
import { inlineFindDir } from "./patches/plugins/find-dir.js";
1718
import { patchInstrumentation } from "./patches/plugins/instrumentation.js";
1819
import { inlineLoadManifest } from "./patches/plugins/load-manifest.js";
19-
import { inlineDynamicRequires } from "./patches/plugins/dynamic-requires.js";
2020
import { handleOptionalDependencies } from "./patches/plugins/optional-deps.js";
2121
import { patchDepdDeprecations } from "./patches/plugins/patch-depd-deprecations.js";
2222
import { fixRequire } from "./patches/plugins/require.js";

packages/cloudflare/src/cli/build/patches/plugins/dynamic-requires.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { readFile } from "node:fs/promises";
2-
import { join , posix, sep } from "node:path";
2+
import { join, posix, sep } from "node:path";
33

44
import { type BuildOptions, getPackagePath } from "@opennextjs/aws/build/helper.js";
55
import { getCrossPlatformPathRegex } from "@opennextjs/aws/utils/regex.js";
@@ -83,11 +83,12 @@ rule:
8383
- has:
8484
field: parameters
8585
has:
86-
kind: identifier
86+
kind: required_parameter
8787
pattern: $ID
8888
inside:
89-
stopBy:
89+
stopBy:
9090
kind: class_declaration
91+
kind: class_declaration
9192
has:
9293
field: name
9394
regex: ^NodeModuleLoader$

0 commit comments

Comments
 (0)