这是indexloc提供的服务,不要输入任何密码
Skip to content

egoist/tsup

Repository files navigation

tsup

Rollup + ESBundle.

This library is intentionally kept simple, if you want customizations please use Rollup directly.

Why Rollup?

Rollup is at least an order of magnitude slower than ESBuild, why not use ESBuild directly?

Because ESBuild isn't mature enough, here we use Rollup to bundle .d.ts files, add code splitting support, import non-js assets etc.

Install

Install it locally in your project folder:

npm i tsup -D
# Or Yarn
yarn add tsup --dev

You can also install it globally but it's not recommended.

Usage

Bundle files

tsup [...files]

Files are written into ./dist.

Generate declaration file

tsup index.ts --dts

This will emit ./dist/index.js and ./dist/index.d.ts.

Bundle files and node modules

tsup [...files] --bundle

dependencies in your packages.json are always excluded, you can also use --external <module> flag to mark specific package as external.

When you're bundling a lot files, this can be 10x~200x slower than ESBuild.

Run a program

tsup run main.ts

For more details:

tsup --help

License

MIT © EGOIST (Kevin Titor)

About

The simplest and fastest way to bundle your TypeScript libraries.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors 98

Languages