How to bundle Typescript libraries with multiple entry points?

This page summarizes the projects mentioned and recommended in the original post on /r/typescript

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • Microbundle

    📦 Zero-configuration bundler for tiny modules.

    Online, on the other hand, the few guides I did find for instance in the microbundle issues have a structure like this:

  • lodash

    A modern JavaScript utility library delivering modularity, performance, & extras.

    I'm not really hellbound on using a specific bundler or toolchain in general, as long as I can get the above features working in a similar fashion to how Lodash, RxJS, and NextAuth.js provide their exports and don't have to come up with my own solution using multiple package.json files or writing scripts that bundle separate packages into one.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

  • RxJS

    A reactive programming library for JavaScript

    I'm not really hellbound on using a specific bundler or toolchain in general, as long as I can get the above features working in a similar fashion to how Lodash, RxJS, and NextAuth.js provide their exports and don't have to come up with my own solution using multiple package.json files or writing scripts that bundle separate packages into one.

  • next-auth

    Authentication for the Web.

    I'm not really hellbound on using a specific bundler or toolchain in general, as long as I can get the above features working in a similar fashion to how Lodash, RxJS, and NextAuth.js provide their exports and don't have to come up with my own solution using multiple package.json files or writing scripts that bundle separate packages into one.

  • typescript-library-tutorial

    A tutorial describing my very simple, dependency-less way to export a Typescript library with sub-modules to be consumed in other TS and JS projects.

  • multiple-entry-points-example

    a npm library with multiple entry points, all typed, all shipped in cjs/esm versions

    Also, I found this repository that uses multiple package.json files to point to the individual dist/* modules that are exported, which I found pretty interesting. I'm trying to work with that technique to see if I can get something setup using Rollup, since there are some nice plugins to merge type definitions to one index.d.ts that I want to leverage.

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