Skip to content

Fail build (/throw errors) when code patching fails #28

@dario-piotrowicz

Description

@dario-piotrowicz

In various places we do some code patching that is completely necessary for the worker to run, for example:

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

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions