Skip to content

Conversation

@taronsung
Copy link

Summary

Adds documentation for using debug with ESM (ECMAScript Modules) import syntax.

Problem

The README currently only shows CommonJS require() examples. As noted in #1019, many modern projects use ESM with import/export syntax, and users may run into issues (like #1001) when they don't know how to properly import the module.

Solution

Added a new "ESM (ECMAScript Modules)" section to the README with clear examples:

  • Basic ESM import usage
  • Using a different variable name for the factory function
  • TypeScript usage example

Example from the new documentation

import debug from 'debug';

const log = debug('app:log');

log('booting %o', 'My App');

Fixes #1019

Add documentation for importing debug using ESM syntax with the import
statement. Includes examples for both JavaScript and TypeScript usage.

Fixes debug-js#1019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation around using ESM imports

1 participant