Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

319
Views
¿Cómo puedo usar el paquete npm "debug" con módulos es?

así es como solía usarlo en módulos comunes.

 const debuger=require('debug')("namespace")

Establecí una variable ambiental DEBUG="namespace" y cuando inicio la aplicación, puedo usar el debugger .

Sin embargo, no pude averiguar cómo usarlo con estamentos de import/export .

 import debugger from "debug" // how can i pass () here
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Tu puedes hacer:

 import debug from 'debug'; const logger = debug('namespace'); logger('Starting App');

En realidad, como el módulo de depuración de npm exporta una función directamente ( module.exports = (params) => {... ), puede darle a la función el nombre que desee, por ejemplo:

 import createDebugMessages from 'debug'; const debug = createDebugMessages('namespace'); debug('Starting App');

De esta manera, ni siquiera es necesario cambiar la sintaxis original para la depuración.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!