Skip to content

add chapter 5: cjs to esm migration#16

Merged
joyeecheung merged 2 commits intonodejs:mainfrom
joyeecheung:chapter-5
Jan 7, 2026
Merged

add chapter 5: cjs to esm migration#16
joyeecheung merged 2 commits intonodejs:mainfrom
joyeecheung:chapter-5

Conversation

@joyeecheung
Copy link
Copy Markdown
Member

@joyeecheung joyeecheung commented Jan 6, 2026

cc @nodejs/package-maintenance @nodejs/package-pathfinders

This is split into 4 subchatpers:

  • Migrating require() to imports
  • Migrating exports
  • Migrating context variables (__dirname, etc.) to import.meta
  • Migrating package.json

Each subchapter contains a before/after folder with the examples mentioned in the documentation, tested by test.mjs.

@AugustinMauroy
Copy link
Copy Markdown
Member

cc @nodejs/userland-migrations we need to transform this ressource into a codemod.

Copy link
Copy Markdown
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome, only a few minor comments and one bigger one.

Comment thread guide/05-cjs-esm-migration/migrating-exports/README.md Outdated
Comment thread guide/05-cjs-esm-migration/migrating-imports/README.md Outdated
Comment thread guide/05-cjs-esm-migration/migrating-package-json/README.md Outdated
@joyeecheung
Copy link
Copy Markdown
Member Author

Updated, PTAL, thanks @ljharb

Copy link
Copy Markdown
Member

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great!

@joyeecheung joyeecheung merged commit 5bb6955 into nodejs:main Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants