in modules/builders/src/prerender/utils.ts [21:53]
export async function getRoutes(
options: PrerenderBuilderOptions,
tsConfigPath: string | undefined,
context: BuilderContext,
): Promise<string[]> {
let routes = options.routes || [];
const { logger, workspaceRoot } = context;
if (options.routesFile) {
const routesFilePath = path.join(workspaceRoot, options.routesFile);
routes = routes.concat(
fs
.readFileSync(routesFilePath, 'utf8')
.split(/\r?\n/)
.filter((v) => !!v),
);
}
if (options.guessRoutes && tsConfigPath) {
try {
routes = routes.concat(
parseAngularRoutes(path.join(workspaceRoot, tsConfigPath))
.map((routeObj) => routeObj.path)
.filter((route) => !route.includes('*') && !route.includes(':')),
);
} catch (e) {
logger.error('Unable to extract routes from application.', e);
}
}
routes = routes.map((r) => (r === '' ? '/' : r));
return [...new Set(routes)];
}