Skip to content

Commit

Permalink
take care of node_modules client modules
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi committed May 20, 2023
1 parent dfa953b commit cd9a909
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/middleware/lib/rsc-handler-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cd9a909

Please sign in to comment.