egoist / tsup

The simplest and fastest way to bundle your TypeScript libraries.
https://tsup.egoist.dev
MIT License
9.27k stars 221 forks source link

Automatically bundle private packages from workspace [feature request] #1251

Open DesselBane opened 3 days ago

DesselBane commented 3 days ago

Context

I work in a mono repo which has a similar setup to this:

I want to bundle and publish @my-company/my-awesome-package.

How it currently works

If I bundle with tsup it will not bundle @repo/my-helper-package in my output and if that output then is pushed to a registry the package is broken.

Currently I have the following line in my tsup.config.ts => noExternal: [/^@repo.*/], which will include all packages which start with @repo into the bundle.

What I would like to do

It would be cool if tsup has a config setting called something like bundlePrivatePackages: boolean. If its false it works like it does now. If its true though tsup would go and inspect the package.json file of imported packages and check if the package has "private": true set, if so it would include it in the output bundle if not leave the import statement.

Upvote & Fund

Fund with Polar