Getting started
Installation
Prerequisites
- Node.js version 18 or higher.
- A package manager: e.g. npm, pnpm, ...
sh
$ npm add -D @ogs-gmbh/rolldown-plugin-package-jsonsh
$ pnpm add -D @ogs-gmbh/rolldown-plugin-package-jsonsh
$ yarn add -D @ogs-gmbh/rolldown-plugin-package-jsonsh
$ bun add -D @ogs-gmbh/rolldown-plugin-package-jsonUsage
rolldown-plugin-package-json can be integrated with either tsdown or Rolldown. Here's an example showing the usage of this plugin with tsdown. You can get a deeper understanding about this plugin by taking a look into the reference.
tsdown.config.ts
ts
import { defineConfig } from "tsdown";
import { packageJsonPlugin } from "@ogs-gmbh/rolldown-plugin-package-json";
export default defineConfig({
entry: "src/**/*.ts",
dts: true,
outDir: "dist/main",
unbundle: true,
plugins: [
packageJsonPlugin({
clean: true,
exports: {
enabled: true,
override: { ".": "./public-api.mjs", "./feature-a": "feature-a.mjs" }
}
})
]
});