docs: add ESM import documentation by taronsung · Pull Request #1022 · debug-js/debug

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