This section introduces how to migrate a project using tsup to Rslib.
First, you need to replace the npm dependencies of tsup with Rslib's dependencies.
Next, you need to update the npm scripts in your package.json to use Rslib's CLI commands.
Create a Rslib configuration file rslib.config.ts in the same directory as package.json, and add the following content:
Here is the corresponding Rslib configuration for tsup configuration:
| tsup | Rslib |
|---|---|
| banner | lib.banner |
| bundle | lib.bundle |
| clean | output.cleanDistPath |
| define | source.define |
| dts | lib.dts |
| entry | source.entry |
| external | output.externals / lib.autoExternal |
| format | lib.format |
| footer | lib.footer |
| minify | output.minify |
| platform | output.target |
| plugins | plugins |
| sourcemap | output.sourceMap |
| shims | lib.shims |
| terserOptions | output.minify |
| tsconfig | source.tsconfigPath |
For platform, tsup defaults to node while Rslib defaults to web (the same as tsup's browser).
If your target platform is node, you can set output.target to node:
The current document only covers part of the migration process. If you find suitable content to add, feel free to contribute to the documentation via pull request 🤝.
The documentation for Rslib can be found in the rslib/website directory.