egoist / tsup

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

how to mark some package form node_modules as internal ? #389

Closed wensonsmith closed 2 years ago

wensonsmith commented 3 years ago

by default dependencies and peerDependencies in your packages.json are always excluded, how can i include some package from dependencies and peerDependencies?

egoist commented 3 years ago

why would you want to bundle a package that is already a dependency?

Wenson Smith @.***>于2021年8月17日 周二下午11:39写道:

by default dependencies and peerDependencies in your packages.json are always excluded, how can i include some package from dependencies and peerDependencies?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/egoist/tsup/issues/389, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACDAWSGKWVHHIN35XZUXKVDT5J7CPANCNFSM5CKEOHYQ .

wensonsmith commented 3 years ago

I use antfu/vitesse-webext template to build a web extension now .

it use tsup to bundle content scripts, which will insert into the web .

in content scripts , i need dayjs to parse & format datetime, dayjs is in dependencies, so tsup didn't bundle it by default, and content script will report an error that can not find dayjs

i just remove dayjs from dependencies as a temporary solution

wensonsmith commented 3 years ago

Demo: https://stackblitz.com/edit/node-rwrubu?file=index.ts

egoist commented 2 years ago

Added a new option noExternal: Array<string | RegExp> in v5.10.0 for this

frontendtony commented 2 years ago

@egoist Thank you for this library and this little extra config option that just saved me from what would've been days of trying to learn how to build a rollup plugin 🙏🏽

dhowe commented 11 months ago

Curious if it possible to use noExternal for one of my output formats, but not the other?