impact on production, how to use debug (use as devDependency?)
See original GitHub issueI first used debug as devDependency, but obviously that would not work.
What is the perf impact on a debug call in production, i.e. process.env.DEBUG not set or NODE_ENV = production?
Is it recommended to wrap debug in a separate file and use require('./debug.js')
, that way it could be a devDependency.
if (!!process.env.DEBUG || process.env.NODE_ENV != 'production'){
try {
module.exports = require('debug');
return;
} catch(e){}
}
module.exports = function(){
return function(){};
};
Would anybody recommend using or not using debug like that?
Thanks for your help
Issue Analytics
- State:
- Created 8 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top Results From Across the Web
impact on production, how to use debug (use as ... - GitHub
I first used debug as devDependency, but obviously that would not work. What is the perf impact on a debug call in production, ......
Read more >Is this a dependency or devDependency? - With Blue Ink
The answer gets less clear-cut when we are dealing with applications that are client-side (running in browsers), pre-processed (e.g. that use ...
Read more >Why is debug used as dependency and not devDependency?
I have seen that a lot of node modules/frameworks (express, sockets.io, body-parser) that use debug as dependency rather than as devDependency, ...
Read more >Do npm dependencies and devDependencies effect your ...
To install all modules listed in both dependencies and devDependencies when NODE_ENV environment variable is set to production , you can use -- ......
Read more >How to tame the devDependencies of your project? - SurviveJS
I've found that the combination of using a package and mrm to manage development dependencies is powerful as it allows you to encapsulate...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK without DEBUG it is actually an empty function, (if my test is correct). So no impact other than calling an empty function. If this is correct, I guess my only question is, is this correct and do people use debug as regular dependency.
The impact of calling debug without
process.env.DEBUG
is negligible, as if I understand it correctly, it is like calling an empty function everywhere. Closing…