question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove Console.log in Angular 9

See original GitHub issue

Is there a feature in this library to remove all the Console.Logs in Angular 9 or higher? If yes, then is there a sample code for it.

Thank you

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
arturovtcommented, Feb 28, 2021

@sonnyk22

This works perfect, just checked it out:

// webpack.config.js
module.exports = config => {
  config.optimization.minimizer.forEach((minimizer) => {
    if (minimizer.constructor.name === 'TerserPlugin') {
      minimizer.options.terserOptions.compress.drop_console = true;
    }
  });

  return config;
};

I think the issue can be closed.

0reactions
pasevincommented, Apr 5, 2021

Thanks, guys, I’m “console.log-free” now 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disabling console.log() in production - Stack Overflow
I have run the following to disable console logs for production environments in my angular application. The below code works as expected for ......
Read more >
The simplest way to disable console.log for Production build in ...
In the service, you can see a function called disableConsoleInProduction(). Inside this function, we are making all the console functions void.
Read more >
Angular – Clear All of Your Console Logs in Production Build ...
Read about a trick to clean up your console.log statements everywhere in your code.
Read more >
Remove Console Logs in Production Build — Angular 2 ...
This article will guide you to prevent the console logging problem in production build in angular 2 and above version, and implement logger ......
Read more >
Angular Remove Console Log - StackBlitz
9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. import { Component, OnInit } from '@angular/. core';. @Component({. selector:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found