Skip to content

Commit 9333581

Browse files
committedSep 27, 2023
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. ``` (cherry picked from commit 26456b9)
1 parent 660d849 commit 9333581

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
@@ -393,6 +393,14 @@ export async function setupServer(
393393
}
394394

395395
transformIndexHtmlAndAddHeaders(url, rawHtml, res, next, async (html) => {
396+
/* eslint-disable no-console */
397+
const originalConsoleLog = console.log;
398+
console.log = (...args) => {
399+
if (args[0] !== 'Angular is running in development mode.') {
400+
originalConsoleLog.apply(args);
401+
}
402+
};
403+
396404
const { content } = await renderPage({
397405
document: html,
398406
route: pathnameWithoutServePath(url, serverOptions),
@@ -407,6 +415,9 @@ export async function setupServer(
407415
inlineCriticalCss: false,
408416
});
409417

418+
console.log = originalConsoleLog;
419+
/* eslint-enable no-console */
420+
410421
return content;
411422
});
412423
}

0 commit comments

Comments
 (0)
Please sign in to comment.