JS Party: JavaScript, CSS, Web Development cover image

JS Party: JavaScript, CSS, Web Development

Modernizing packages to ESM

Sep 1, 2023
Mark Erikson, web dev professor/historian, OSS Maintainer & engineer at Replay, talks about the shift from CommonJS to ESM in JavaScript modules. They discuss the history of module patterns, challenges faced during the transition, modernizing packages to ESM and TypeScript compatibility, and the need for standards in package publishing.
01:05:15

Episode guests

Podcast summary created with Snipd AI

Quick takeaways

  • The challenges faced in adopting ESM in the node ecosystem include issues with tooling, compatibility with bundlers, TypeScript integration, and module resolution confusion.
  • TypeScript adds complexity to the ESM ecosystem due to its types-only overlay, leading to mismatches between runtime code and type definitions, the need to rewrite import statements in JavaScript files, and publishing multiple copies of TypeScript types with different extensions.

Deep dives

Challenges of Modernizing Node Packages to Use ESM

The podcast episode discusses the challenges faced by Mark Erickson, a maintainer, in modernizing his node packages to use ECMAScript Modules (ESM). Mark explains that JavaScript initially lacked a built-in way to define packages, which led to the invention of different module formats like AMD and CommonJS. With the introduction of ES modules in the ES2015 spec, the ecosystem started transitioning towards them, but it hasn't been a smooth process. Mark highlights the issues related to tooling, compatibility with bundlers, TypeScript integration, and the confusion surrounding module resolution. He also mentions pain points experienced by app developers, such as compatibility issues when upgrading dependencies and the need to revert to previous versions. The summary captures the overall discussion of the challenges faced in adopting ESM in the node ecosystem.

Remember Everything You Learn from Podcasts

Save insights instantly, chat with episodes, and build lasting knowledge - all powered by AI.
App store bannerPlay store banner