Skip to content

Commit 6afac13

Browse files
committed
pnpm fix and change whitespace in getRequires
1 parent d87c9c1 commit 6afac13

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

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

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import { readFile } from "node:fs/promises";
2-
import { join } 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";
6+
import type { Plugin } from "esbuild";
67

78
import { normalizePath } from "../../utils/normalize-path.js";
89
import { patchCode, type RuleConfig } from "../ast/util.js";
910
import type { ContentUpdater } from "./content-updater.js";
10-
import { posix, sep } from "node:path";
11-
import type { Plugin } from "esbuild";
1211

1312
async function getPagesManifests(serverDir: string): Promise<string[]> {
1413
try {
@@ -36,9 +35,8 @@ function getRequires(idVariable: string, files: string[], serverDir: string) {
3635
// Inline fs access and dynamic requires that are not supported by workerd.
3736
return files
3837
.map(
39-
(
40-
file
41-
) => `if (${idVariable}.replaceAll(${JSON.stringify(sep)}, ${JSON.stringify(posix.sep)}).endsWith(${JSON.stringify(normalizePath(file))})) {
38+
(file) => `
39+
if (${idVariable}.replaceAll(${JSON.stringify(sep)}, ${JSON.stringify(posix.sep)}).endsWith(${JSON.stringify(normalizePath(file))})) {
4240
return require(${JSON.stringify(join(serverDir, file))});
4341
}`
4442
)
@@ -71,7 +69,7 @@ export function inlineDynamicRequires(updater: ContentUpdater, buildOpts: BuildO
7169
async function getNodeModuleLoaderRule(buildOpts: BuildOptions) {
7270
const serverDir = getServerDir(buildOpts);
7371

74-
let manifests = await getPagesManifests(serverDir);
72+
const manifests = await getPagesManifests(serverDir);
7573

7674
const files = manifests.filter((file) => file.endsWith(".js"));
7775

0 commit comments

Comments
 (0)