sebamarynissen / debug-ns

A small wrapper around debug for usage with esm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

debug-ns

This module is a small wrapper around the pattern

import createDebug from 'debug';
const debug = createDebug('namespace');

With this module, you can do

import debug from 'debug-ns/?namespace';

instead.

A note on transpiling

This package is esm only. It doesn't make sense in a CommonJS environment because require expects file paths. It can't handle url specifiers.

If you're using CommonJS you also don't need this package because you can just do

const debug = require('debug')('namespace');

This also means that it MUST NOT be used in code that might get transpiled to CommonJS. If your bundler supports outputting esm code, then it might work, but don't kill me if it doesn't.

If you're using TypeScript, make sure that TypeScript outputs esm code!

About

A small wrapper around debug for usage with esm

License:MIT License


Languages

Language:JavaScript 100.0%