unplugin-license
v0.1.3
Published
Collect OSS licenses from bundled files and output third party licenses
Maintainers
Readme
unplugin-license
A plugin for tsdown, Vite, and other bundlers that collects OSS licenses from bundled files and outputs third-party licenses.
Install
pnpm add -D unplugin-license// tsdown.config.ts
import { defineConfig } from "tsdown";
import License from "unplugin-license/rolldown";
export default defineConfig({
plugins: [
License({
output: {
file: "NOTICE.md",
},
}),
],
});// vite.config.ts
import { defineConfig } from "vite";
import License from "unplugin-license/vite";
export default defineConfig({
plugins: [
License({
output: {
file: "NOTICE.md",
},
}),
],
});// rollup.config.ts
import License from "unplugin-license/rollup";
export default {
plugins: [
License({
output: {
file: "NOTICE.md",
},
}),
],
};// rolldown.config.ts
import License from "unplugin-license/rolldown";
export default {
plugins: [
License({
output: {
file: "NOTICE.md",
},
}),
],
};// rspack.config.ts
import License from "unplugin-license/rspack";
export default {
plugins: [
License({
output: {
file: "NOTICE.md",
},
}),
],
};// build.ts
import { build } from "esbuild";
import License from "unplugin-license/esbuild";
await build({
entryPoints: ["src/index.ts"],
bundle: true,
plugins: [
License({
output: {
file: "NOTICE.md",
},
}),
],
});// build.ts
import License from "unplugin-license/bun";
await Bun.build({
entrypoints: ["src/index.ts"],
outdir: "dist",
plugins: [
License({
output: {
file: "NOTICE.md",
},
}),
],
});Options
output.file
The output path for the generated license notice.
Relative paths are emitted as bundled assets:
License({
output: {
file: "NOTICE.md",
},
});If you want to specify the output destination using an absolute path, please use a URL that follows the file protocol. For example:
License({
output: {
file: import.meta.resolve("./NOTICE.md"), // file:///absolute/path/to/NOTICE.md
},
});Feedback
Found a bug or have an idea for a new feature? Please fill out an issue.
License
MIT-0
