modernweb-dev / web

Guides, tools and libraries for modern web development.
https://modern-web.dev
MIT License
2.23k stars 297 forks source link

Make web-test-runner and web-dev-server pure ESM packages #1642

Open web-padawan opened 3 years ago

web-padawan commented 3 years ago

Motivation

Once Node.js 16 becomes LTS, it will become a third LTS version with native ES modules support.

Some maintainers have already started migrating their packages to be pure ES modules. See the gist for an explanation of what it a pure ESM package.

In practice, it means that we drop support for CommonJS and drop support for older node versions (10.x).

Dependencies

Making @web packages pure ES modules would enable us to use dependencies that are pure ES modules too:

There might be other dependencies that get major bumps with dropping support for CommonJS in future.

Proposed solution

  1. Update "exports" field to remove "require" entrypoints for all affected packages
  2. Add "type": "module" to package.json to indicate packages are pure ES modules
  3. Maybe also a few other tweaks, see How can I move my CommonJS project to ESM?
Westbrook commented 3 years ago

I like it! Would we also be in a place to use this change as he switch to 1.0?

web-padawan commented 3 years ago

The first step would be to bump minimal Node.js version: #1647

web-padawan commented 3 years ago

Some PRs that also not directly related but need to be merged before 1.0: