@pkg-tools/build
v1.0.2
Published
A utility/tool for building packages
Downloads
539
Readme
@pkg-tools/build
A build tool with typed configuration.
This tool is a thin abstraction on top of unbuild. It centralizes your build configuration, which helps us consistently build opensource packages that support both module systems (CJS and ESM).
Install
# w/ pnpm
pnpm add -D @pkg-tools/build @pkg-tools/config
# w/ yarn
yarn add -D @pkg-tools/build @pkg-tools/config
# w/ npm
npm install -D @pkg-tools/build @pkg-tools/config
Usage
In your package.json
, you can use the exported cli build
in your build script e.g.
"scripts": {
"build": "build"
"dev": "build -w"
"stub": "build -s"
}
Configure
Define a pkg.config.ts
in the root of your package and add the following.
import { defineConfig } from "@pkg-tools/config";
export default defineConfig({
build: {
entries: ["src/index"],
sourcemap: true,
extensions: "compatible",
rollup: {
inlineDependencies: true,
emitCJS: true,
esbuild: {
target: ["node16"],
minify: true,
},
},
declaration: "compatible",
},
});