-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
if the buildscript in package.json contains any {} like this:
"build": "ng build --configuration ${APP_ENV:-development}",
this is due to extractManifestOutput function that searches the occurence of curly braces
/**
* Extracts the build manifest from the build command's console output.
* N.B. Unfortunately, there is currently no consistent way to suppress extraneous default output from the task
* runners of monorepo tools such as Nx (i.e. using the --silent flag for npm scripts). As a result, we must
* temporarily resort to "cleaning" the output of executing the Angular application builder in a monorepo's tooling
* context, in order to extract the build manifest. This method is a potentially flaky stopgap until we can find a
* more consistent and resilient strategy for reading the output.
*/
function extractManifestOutput(output: string): string {
const start = output.indexOf("{");
const end = output.lastIndexOf("}");
if (start === -1 || end === -1 || start > end) {
throw new Error(`Failed to find valid JSON object from build output: ${output}`);
}
// Clean the raw json string by removing the "web:build:" prefixes for a Turbo build
const prefixRegex = /\n?web:build:/g;
const cleanedOutput = output.substring(start, end + 1).replace(prefixRegex, "");
return stripAnsi(cleanedOutput);
}
[4/4] Building fresh packages...
--
|
| > merge-mate-web@0.1.0 build
| > ng build --configuration ${APP_ENV:-development}
|
| ❯ Building...
| file:///layers/google.nodejs.firebaseangular/npm_modules/node_modules/@apphosting/adapter-angular/dist/utils.js:131
| throw new Error(`Failed to parse build output manifest: ${error}`);
| ^
|
| Error: Failed to parse build output manifest: SyntaxError: Expected property name or '}' in JSON at position 1 (line 1 column 2)
| at parseOutputBundleOptions (file:///layers/google.nodejs.firebaseangular/npm_modules/node_modules/@apphosting/adapter-angular/dist/utils.js:131:15)
| at file:///layers/google.nodejs.firebaseangular/npm_modules/node_modules/@apphosting/adapter-angular/dist/bin/build.js:19:33
| at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
|
| Node.js v22.22.0
| Done "npm exec --prefix /layers/google.nodejs.firebaseangular/npm_..." (1m19.510411244s)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels