Building NPM packages for CommonJS with ESM dependencies

This page summarizes the projects mentioned and recommended in the original post on dev.to

SurveyJS - JavaScript Form Builder with No-Code UI & Built-In JSON Schema Editor
Add the SurveyJS white-label form builder to your JavaScript app (React/Angular/Vue3). Build complex JSON forms without coding. Fully customizable, works with any backend, perfect for data-heavy apps. Learn more.
surveyjs.io
featured
Civic Auth - Auth in Less Than 5 Minutes
Civic Auth comes with multiple SSO options, optional embedded wallets, and user management — all implemented with just a few lines of code. Start building today.
www.civic.com
featured
  1. esm-commonjs-support

    If you're impatient, you can go straight to the code with this example implementation.

  2. SurveyJS

    JavaScript Form Builder with No-Code UI & Built-In JSON Schema Editor. Add the SurveyJS white-label form builder to your JavaScript app (React/Angular/Vue3). Build complex JSON forms without coding. Fully customizable, works with any backend, perfect for data-heavy apps. Learn more.

    SurveyJS logo
  3. esbuild

    An extremely fast bundler for the web

    You have to use a bundler such as esbuild which will compile your project and bundle all of it's dependencies along with it so they aren't imported. This bypasses the ESM/CommonJS incompatibility issue.

  4. token.js

    Integrate 200+ LLMs with one TypeScript SDK using OpenAI's format.

    While preparing to release my new project Token.js over the weekend, I ran into a quite frustrating problem. I wanted my package to support CommonJS in addition to ESM, but I had pure ESM dependencies. The pure ESM crusaders out there might be quite unhappy about me saying it, but if you are building an NPM package and want it to be widely used you still need to support CommonJS in 2024.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Esbuild – An Fast Bundler for the Web

    1 project | news.ycombinator.com | 7 May 2025
  • Node.js and esbuild: beware of mixing cjs and esm

    2 projects | dev.to | 13 Dec 2024
  • ESBuild package gone from NPM registry

    1 project | news.ycombinator.com | 8 Dec 2024
  • Optimising package size for Typescript AWS Lambda functions using serverless-esbuild

    1 project | dev.to | 18 Jul 2024
  • Esbuild implements the JavaScript decorators proposal

    1 project | news.ycombinator.com | 7 May 2024

Did you know that TypeScript is
the 1st most popular programming language
based on number of references?