Add documentation around using ESM imports

Open Beginner friendly
#1,019 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
82/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
javascript
Domain
documentation

Research direction

Start in the README and review its existing CommonJS import guidance, then compare the issue's proposed ESM examples with the package's documented exports. Update the README with accurate ESM import information and confirm that the examples clearly cover the default import and alias cases.

Written by the indexing model from the issue text.

Description

I ran into an issue with named imports that was similar to #1001, and then I noticed that the README does not include any information on how to import this package using ESM.

Could the README be updated since there are more projects using modules with import/export syntax over commonjs?

Edit: it possibly just needs a reference to use this syntax:

//import comes from the default export
import debug from 'debug';
export default debug('your-package-name')


//With an alias
import {default as debugInitializer} from 'debug';
export default const debug('your-package-name')
Dominant language
JavaScript
Stars
11.5k
Forks
992
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from debug-js/debug

All issues in debug-js/debug

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.