Skip to content

Commit 26456b9

Browse files
committed
fix(@angular-devkit/build-angular): do not print Angular is running in development mode. in the server console when using dev-server
This commit disables logging `Angular is running in development mode.` when using SSR with vite dev-server. This to avoid polluting the server console with `Angular is running in development mode.` logs for each page load and reload. Example: ``` ng s Initial Chunk Files | Names | Raw Size main.js | main | 34.31 kB | polyfills.js | polyfills | 95 bytes | styles.css | styles | 95 bytes | | Initial Total | 34.49 kB Application bundle generation complete. [5.205 seconds] ➜ Local: http://localhost:4200/ Watch mode enabled. Watching for file changes... Angular is running in development mode. Angular is running in development mode. Angular is running in development mode. Angular is running in development mode. Angular is running in development mode. Angular is running in development mode. ```
1 parent 6b5c469 commit 26456b9

File tree

1 file changed

+11
-0
lines changed
  • packages/angular_devkit/build_angular/src/builders/dev-server

1 file changed

+11
-0
lines changed

packages/angular_devkit/build_angular/src/builders/dev-server/vite-server.ts

+11
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,14 @@ export async function setupServer(
450450
}
451451

452452
transformIndexHtmlAndAddHeaders(url, rawHtml, res, next, async (html) => {
453+
/* eslint-disable no-console */
454+
const originalConsoleLog = console.log;
455+
console.log = (...args) => {
456+
if (args[0] !== 'Angular is running in development mode.') {
457+
originalConsoleLog.apply(args);
458+
}
459+
};
460+
453461
const { content } = await renderPage({
454462
document: html,
455463
route: pathnameWithoutServePath(url, serverOptions),
@@ -464,6 +472,9 @@ export async function setupServer(
464472
inlineCriticalCss: false,
465473
});
466474

475+
console.log = originalConsoleLog;
476+
/* eslint-enable no-console */
477+
467478
return content;
468479
});
469480
}

0 commit comments

Comments
 (0)