Mark Erikson joins to talk about the shift from CommonJS to ESM. They discuss the history of module patterns in JS, challenges of publishing packages and the need for standards in package publishing. The chapter also explores the ongoing relevance and benefits of CommonJS in package modernization.
Read more
AI Summary
AI Chapters
Episode notes
auto_awesome
Podcast summary created with Snipd AI
Quick takeaways
The challenges faced in modernizing node packages to support ESM, including issues with different tools and environments, mismatches between runtime behavior and TypeScript types, and complexities of the React server components environment.
Issues app developers encounter when modernizing node packages to support ESM, such as import errors, library authors switching to ESM-only releases, and the need to maintain compatibility by reverting to previous library versions.
The challenges faced by Redux maintainers and other libraries with the introduction of React server components, including compatibility concerns, conflicts with Next Canary builds, and increased workload for maintainers in generating separate build artifacts.
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 ESM (ECMAScript Modules). The episode highlights how JavaScript lacked a built-in way to define packages or reusable modules, unlike other languages like Java or Python. This led to the development of community-defined specs such as AMD (Asynchronous Module Definition) and CommonJS module format. Eventually, ES modules were incorporated into the ES 2015 spec. The episode explores the difficulties in handling the transition to ESM, including issues with different tools and environments, mismatches between runtime behavior and TypeScript types, and the complexities of the React server components environment. The episode also touches on the friction experienced by developers relying on libraries with different module formats and the need for documentation and standards to mitigate these challenges.
Impact on App Developers
The podcast highlights how app developers can be affected by the challenges related to modernizing node packages to support ESM. This includes encountering import errors in node contexts, problems arising from library authors switching to ESM-only releases, and the need to revert to previous library versions to maintain compatibility. The discussion emphasizes how developers often encounter issues when using libraries in different runtime environments, bundlers, and tools. The episode points out the importance of tools like 'Are the Types Wrong' by Andrew Branch in identifying mismatches between JS files and types, as well as the need to set up example projects to verify compatibility across different environments.
Server Components and Maintainer Collaboration
The podcast episode delves into the challenges faced by Redux maintainers, Apollo, and other libraries due to the introduction of React server components. The lack of clear guidelines and training wheels during the rollout of this feature led to issues for library maintainers and users. The conversation covers debates around ensuring compatibility with React server components, potential conflicts between libraries and Next Canary builds, and the additional workload for maintainers in generating separate build artifacts. The episode emphasizes the need for standards, documentation, and collaboration between library maintainers and framework developers to streamline the development and usage of server components.
Difficulty in publishing modern JavaScript as dependencies
The podcast episode discusses the challenges faced in publishing modern JavaScript as dependencies in the current ecosystem. This is due to the need to support older browsers and the lack of a standard for publishing dependencies. Transpiling and managing dependencies become complex tasks, leading to increased bundle size and inefficient code. However, there is a push to publish modern JavaScript to optimize web performance and reduce resource consumption.
Pain points in transitioning to new package publishing standards
The podcast covers the pain points experienced while transitioning to new package publishing standards. The speaker shares their personal journey in updating Redux-related packages and highlights issues such as file format compatibility, TypeScript configurations, and the challenges of working with different build tools. The lack of comprehensive guides and standardization in the ecosystem further complicates the process. Despite these challenges, efforts are being made to address the pain points and improve the publishing process for libraries.
Mark Erikson (web dev professor/historian, OSS Maintainer & engineer at Replay) joins us to talk about the shift from CommonJS to ESM. We discuss the history of module patterns in JS and the grueling effort to push the world’s biggest developer ecosystem forward. Get ready to go to school kids, this one’s deep!
Changelog++ members get a bonus 5 minutes at the end of this episode and zero ads. Join today!
Sponsors:
Fastly – Our bandwidth partner. Fastly powers fast, secure, and scalable digital experiences. Move beyond your content delivery network to their powerful edge cloud platform. Learn more at fastly.com
Fly.io – The home of Changelog.com — Deploy your apps and databases close to your users. In minutes you can run your Ruby, Go, Node, Deno, Python, or Elixir app (and databases!) all over the world. No ops required. Learn more at fly.io/changelog and check out the speedrun in their docs.
Typesense – Lightning fast, globally distributed Search-as-a-Service that runs in memory. You literally can’t get any faster!