A vite plugin to fill out your package.json
files for its local and published
variants.
Add it to the plugins
array in your vite.config.ts
file!
It is also wrapping vite-plugin-dts!
import { defineConfig } from 'vite';
import { pakk } from 'vite-plugin-pakk';
export default defineConfig({
plugins: [pakk()],
});
index.ts
will be treated as the default export, and any additional files
will be treated as other entry points. This means you have to put every other
internal file in a directory!package.json
file too! For types
it will point to
your internal typescript file (./src/index.ts
) but for the actual code, it
will point to your outDir
(./dist/index.js
). This ensures that you build
and test with the actual build artifact, but let's you see changes
immediately! (It assumes your build and test tools build dependencies before
building or testing any package!)package.json
file so it points to the correct
paths for both types (./index.d.ts
) and ESM/CJS files (./index.js
,
./index.cjs
)bin
will be treated as bins for the package. Shims
and bin entries will automatically be created to allow them to be used locally
too, not to disturb package managers like pnpm
when they create symlinks.static
folder next to src
too to export non-js files like
the docs or images.dts
generator plugin present!