We’re experiencing this with "next": "13.4.19" using app router.
Root page.js loads fine but even a simple directory/page.js is having this issue when loaded by itself. It does work however if navigated to from a next link from the root page…
Any update?
UPDATE:
We were able to resolve by adding the prebuild script and downgrading next to 13.4.9
Add "prebuild": "node prebuild.js" to package.json scripts
Add prebuild.js
console.log("********* PREBUILDING");
const path = require("node:path");
const fs = require("fs");
const baseDir = process.cwd();
const prebuildScripts = async () => {
const file = path.join(
baseDir,
"/node_modules",
"next/dist/server/require-hook.js"
);
const content = await fs.promises.readFile(file, "utf-8");
await fs.promises.writeFile(
file,
content.replace(
"if (process.env.__NEXT_PRIVATE_PREBUNDLED_REACT) {",
"if (true) {"
)
);
};
prebuildScripts();