How to bundle Typescript libraries with multiple entry points?

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

Our great sponsors
  • Appwrite - The Open Source Firebase alternative introduces iOS support
  • Scout APM - Less time debugging, more time building
  • SonarQube - Static code analysis for 29 languages.
  • 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.

  • 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!

  • 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 Next.js

    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