Skip to content

Migrating to ESM only#703

Description

@43081j

Hello 馃憢

today, this package has multiple copies/entries in it:

  • dist/diff.js - a UMD bundle
    • Only exposed under package.json#browser and package.json#unpkg keys
    • Suggests this is the browser bundle
  • dist/diff.min.js - the same UMD bundle minified
  • libjs/ - a CommonJS entry point
    • Includes types
    • Includes sourcemaps
  • libesm/ - an ES module entry point
    • Includes types
    • Includes sourcemaps

Times have changed a bunch since this package was created. We're now in a situation where:

  • All browsers support ES modules
  • All runtimes (e.g. Node, Bun, etc.) support ES modules
  • CommonJS projects in Node can require(esm) an ES module
  • Most web projects today are using a bundler

So it seems there's opportunity here for a new major one day which dumbs this down to:

  • dist/ - an ES module entry point
    • Includes types
    • Includes sourcemaps

would love to hear your thoughts on this @kpdecker 馃檹

an extra win from this could also be to stop shipping sourcemaps (which account for a large % of the tarball size we pull from npm). The code is already readable, unminified, and has type definitions. So we're not gaining much from shipping them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions