Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to import and use debug using es6 import syntax #692

Closed
pavanjadhaw opened this issue Mar 3, 2019 · 5 comments
Closed

how to import and use debug using es6 import syntax #692

pavanjadhaw opened this issue Mar 3, 2019 · 5 comments

Comments

@pavanjadhaw
Copy link

import Debug from 'debug';
const debug = Debug('myapp');

I am trying to above syntax, app runs as expected but no debug output is shown

@Qix-
Copy link
Member

Qix- commented Mar 3, 2019

Please see the readme. You need to set an environment variable in Node.

@Qix- Qix- closed this as completed Mar 3, 2019
@williamokano
Copy link

This doesn't make sense @Qix- , the question is how to import using ES6 import syntax, not how to use the lib. In the readme they only teach how to import it using require.

BTW, I'm also looking for this answer

@pavanjadhaw
Copy link
Author

Setting environment variable fixed my problem, I was just little confused if the path I was following was right. Seems thats the correct syntax for importing and using debug with es6 import syntax

@Qix-
Copy link
Member

Qix- commented Mar 27, 2019

Sorry should have spelled it out a bit more. How OP is using it is fine. No output means they didn't set the environment variable (which is very, very well documented in the readme).

@YuriyVorobyov1333
Copy link

import Debug from "debug";
const debug = Debug("MyApp");

// then to use
debug("Something happened");

@debug-js debug-js locked as resolved and limited conversation to collaborators Oct 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

4 participants