From cd9a909c18bc0c1a46fa4b25e364b0d871c9e262 Mon Sep 17 00:00:00 2001 From: daishi Date: Sat, 20 May 2023 11:19:56 +0900 Subject: [PATCH] take care of node_modules client modules --- src/middleware/lib/rsc-handler-worker.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/middleware/lib/rsc-handler-worker.ts b/src/middleware/lib/rsc-handler-worker.ts index ef3821250..6c24f3cfe 100644 --- a/src/middleware/lib/rsc-handler-worker.ts +++ b/src/middleware/lib/rsc-handler-worker.ts @@ -201,6 +201,10 @@ const getDecodeId = async (loadClientEntries: boolean, isBuild: boolean) => { const baseDir = isBuild ? path.join(dir, distPath) : dir; if (id.startsWith(baseDir)) { id = basePath + getClientEntry(path.relative(baseDir, id)); + } else if (id.startsWith(path.join(dir, "node_modules"))) { + id = + basePath + + getClientEntry(path.relative(path.join(dir, "node_modules"), id)); } else { if (isBuild || process.env.NODE_ENV === "production") { throw new Error("decodeId: no relative path in production: " + id);