Skip to content

Instantly share code, notes, and snippets.

@ayyash
Created October 2, 2022 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayyash/2ecb31ad9977e293254d26b90dde7a34 to your computer and use it in GitHub Desktop.
Save ayyash/2ecb31ad9977e293254d26b90dde7a34 to your computer and use it in GitHub Desktop.
Rewriting Execute function
export async function execute(
options: IOptions,
context: BuilderContext,
): Promise<BuilderOutput> {
// read browser options and setup the clientPath
const browserTarget = targetFromTargetString(options.browserTarget);
const browserOptions = (await context.getTargetOptions(browserTarget)) as any;
const clientPath = path.resolve(context.workspaceRoot, browserOptions.outputPath );
// and server options
const serverTarget = targetFromTargetString(options.serverTarget);
const serverOptions = (await context.getTargetOptions(serverTarget)) as any;
const serverPath = path.resolve(context.workspaceRoot, serverOptions.outputPath);
// now we do not need to schedule any builder
return _renderUniversal(
routes,
context,
// now we pass strings for paths instead of browserResult and serverResult
clientPath,
serverPath,
// we just need the index file from options
getIndexOutputFile(browserOptions),
// since we are dropping piscina this won't be necessary
// options.numProcesses
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment