-
Notifications
You must be signed in to change notification settings - Fork 73
Closed
Labels
Description
In various places we do some code patching that is completely necessary for the worker to run, for example:
opennextjs-cloudflare/packages/cloudflare/src/build/patches/to-investigate/patch-find-dir.ts
Lines 12 to 22 in 42320e7
return code.replace( | |
"function findDir(dir, name) {", | |
`function findDir(dir, name) { | |
if (dir.endsWith(".next/server")) { | |
if (name === "app") return ${existsSync(`${nextjsAppPaths.standaloneAppServerDir}/app`)}; | |
if (name === "pages") return ${existsSync(`${nextjsAppPaths.standaloneAppServerDir}/pages`)}; | |
} | |
throw new Error("Unknown findDir call: " + dir + " " + name); | |
` | |
); | |
} |
But we do not check if such patches have been completed successfully (e.g. in the example above we never check wether "function findDir(dir, name) {"
is actually found and replaced in the code or not)
In order not to complete the build process in a seemingly successful way just to end up with a non-fully (or not-at-all) functional worker we should throw errors and fail the build process in case some of these patches aren't getting successfully applied.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done