What does it take to support Node.js ESM?

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

Our great sponsors
  • Appwrite - The Open Source Firebase alternative introduces iOS support
  • Sonar - Write Clean JavaScript Code. Always.
  • InfluxDB - Build time-series-based applications quickly and at scale.
  • plugins

    🍣 The one-stop shop for official Rollup plugins (by rollup)

    The only workaround to have an isomorphic __dirname or __filename to be used for both "cjs" and "esm" without using build-time tools like @rollup/plugin-replace or esbuild "define" would be using a library like filedirname that does a trick inspecting error stacks, it's clearly not the cleanest solution.

  • TypeScript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    Until this issue TypeScript#33069 is closed, TypeScript doesn't have complete support for it, fortunately, there are 2 workarounds:

  • Appwrite

    Appwrite - The Open Source Firebase alternative introduces iOS support . Appwrite is an open source backend server that helps you build native iOS applications much faster with realtime APIs for authentication, databases, files storage, cloud functions and much more!

  • bob

    Build tool used in libraries maintained by The Guild (by kamilkisiela)

    In The Guild we use this method using tooling that creates the temporary package.json automatically. See bob-the-bundler & bob-esbuild

  • bob-esbuild

    Building and Running TypeScript projects efficiently with rollup + esbuild

    In The Guild we use this method using tooling that creates the temporary package.json automatically. See bob-the-bundler & bob-esbuild

  • tsup

    The simplest and fastest way to bundle your TypeScript libraries.

    The best solution for this is to have ESM examples in a monorepo testing firsthand if everything with the logic included doesn't break, using tools that output both CommonJS & ESM like tsup might become very handy, but that might not be straightforward, especially for big projects.

  • ts-jest

    A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript.

    There are workarounds, but nothing actually works in 100% of the possible use-cases (see for example, ts-jest issue), and for that reason, we recommend tooling that enables this type of building without needing any workaround, usually using Rollup and/or esbuild.

  • Stack

    Tech Stack developed by The Guild (by the-guild-org)

    In The Guild we use this method using tooling that creates the temporary package.json automatically. See bob-the-bundler & bob-esbuild

  • Sonar

    Write Clean JavaScript Code. Always.. Sonar helps you commit clean code every time. With over 300 unique rules to find JavaScript bugs, code smells & vulnerabilities, Sonar finds the issues while you focus on the work.

  • Rollup

    Next-generation ES module bundler

    There are workarounds, but nothing actually works in 100% of the possible use-cases (see for example, ts-jest issue), and for that reason, we recommend tooling that enables this type of building without needing any workaround, usually using Rollup and/or esbuild.

  • esbuild

    An extremely fast bundler for the web

    There are workarounds, but nothing actually works in 100% of the possible use-cases (see for example, ts-jest issue), and for that reason, we recommend tooling that enables this type of building without needing any workaround, usually using Rollup and/or esbuild.

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