This software is experimental.
A better (opinionated) way to bundle your TypeScript libraries, powered by Vite + SWC.
- Output format(s) & directory derived from package.json exports & other package.json fields.
- SWC compiler integration with vite-plugin-swc-transform by default
- Zero-to-minimal configuration required, freedom to override
npm i --save-dev viteup
Note: if you plan on using a different compiler than SWC, you can avoid installing the vite-plugin-swc-transform
dependency:
npm i --save-dev --no-optional viteup
- Add a package.json
exports
or output field to yourpackage.json
file - Add a "build" script to your
package.json
file
{
"name": "my-library",
"type": "module",
"exports": "./dist/index.js",
"scripts": {
"build": "viteup"
}
}
npm run build
{
"name": "my-library",
["type": "commonjs",]
"main": "./dist/index.js",
"scripts": {
"build": "viteup"
}
}
{
"name": "my-library",
["type": "commonjs",]
"exports": "./dist/index.js",
"scripts": {
"build": "viteup"
}
}
{
"name": "my-library",
"module": "./dist/index.mjs",
"scripts": {
"build": "viteup"
}
}
{
"name": "my-library",
"type": "module",
"exports": "./dist/index.js",
"scripts": {
"build": "viteup"
}
}
{
"name": "my-library",
"type": "module",
"exports": {
"require": "./dist/index.cjs",
"default": "./dist/index.js"
},
"scripts": {
"build": "viteup"
}
}
{
"name": "my-library",
["type": "commonjs",]
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"exports": {
"require": "./dist/index.js",
"default": "./dist/index.mjs"
},
"scripts": {
"build": "viteup"
}
}
- FIXME
- FIXME
- FIXME
- FIXME
- FIXME