tsup
This section introduces how to migrate a project using tsup to Rslib.
Installing dependencies
First, you need to replace the npm dependencies of tsup with Rslib's dependencies.
- Remove tsup:
- Install Rslib:
Updating npm scripts
Next, you need to update the npm scripts in your package.json to use Rslib's CLI commands.
Create configuration file
Create a Rslib configuration file rslib.config.ts in the same directory as package.json, and add the following content:
Configuration migration
Here is the corresponding Rslib configuration for tsup configuration:
Example
Here is an example of migrating a typical tsup configuration to Rslib:
The corresponding Rslib configuration is as follows:
Validating results
After completing the above steps, you have finished the basic migration from tsup to Rslib. You can now run the npm run build command to build the outputs and verify that the directory structure and extensions of the outputs are consistent with those before the migration.
If you encounter issues during the build process, please debug according to the error logs. You can also enable debug mode to view the final configurations generated by Rslib, or check the tsup.config.ts configuration to see if any required configurations have not been migrated to Rslib.
Contents supplement
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 a pull request 🤝.
The documentation for Rslib can be found in the rslib/website directory.
