Pack
vp pack builds libraries for production with tsdown.
Overview
vp pack builds libraries and standalone executables with tsdown. Use it for publishable packages and binary outputs. If you want to build a web application, use vp build. vp pack covers everything you need for building libraries out of the box, including declaration file generation, multiple output formats, source maps, and minification.
For more information about how tsdown works, see the official tsdown guide.
Usage
vp pack
vp pack src/index.ts --dts
vp pack --watchConfiguration
Put packaging configuration directly in the pack block in vite.config.ts so all your configuration stays in one place. We do not recommend using tsdown.config.ts with Vite+.
See the tsdown guide and the tsdown config file docs to learn more about how to use and configure vp pack.
Use it for:
import { defineConfig } from 'vite-plus';
export default defineConfig({
pack: {
dts: true,
format: ['esm', 'cjs'],
sourcemap: true,
},
});Standalone Executables
vp pack can also build standalone executables through tsdown's experimental exe option.
Use this when you want to ship a CLI or other Node-based tool as a native executable that runs without requiring Node.js to be installed separately.
import { defineConfig } from 'vite-plus';
export default defineConfig({
pack: {
entry: ['src/cli.ts'],
exe: true,
},
});Executable support is bundled into Vite+, so you do not need to install @tsdown/exe separately.
Building executables uses Node's Single Executable Applications support and requires Node.js 25.7.0 or later. Switch the active runtime with vp env use 26 if vp pack --exe reports an unsupported version.
See the official tsdown executable docs for details about configuring custom file names, embedded assets, and cross-platform targets.
CSS Bundling
vp pack can transform and bundle CSS (including CSS Modules and Lightning CSS optimizations) for your entry points. This support is bundled into Vite+, so you do not need to install @tsdown/css or lightningcss separately, it works out of the box.