Files
zod-schema-class/rollup.config.ts
Julien Valverdé 019066bb9c
All checks were successful
continuous-integration/drone/push Build is passing
0.1.1 (#2)
Co-authored-by: Julien Valverdé <julien.valverde@mailo.com>
Reviewed-on: https://git.jvalver.de/Thilawyn/schemable-class/pulls/2
2024-01-17 20:47:13 +01:00

45 lines
1.1 KiB
TypeScript

import { nodeResolve } from "@rollup/plugin-node-resolve"
import { defineConfig } from "rollup"
import cleanup from "rollup-plugin-cleanup"
import ts from "rollup-plugin-ts"
import pkg from "./package.json" assert { type: "json" }
export const createBundleConfig = (
input: string,
name: keyof typeof pkg.exports,
) =>
defineConfig({
input,
output: [
{
file: pkg.exports[name].import.default,
format: "esm",
},
{
file: pkg.exports[name].require.default,
format: "cjs",
},
],
external: id => !/^[./]/.test(id),
plugins: [
nodeResolve(),
ts(),
cleanup({
comments: "jsdoc",
extensions: ["ts"],
}),
],
})
export default [
createBundleConfig("src/index.ts", "."),
createBundleConfig("src/jsonifiable/index.ts", "./jsonifiable"),
createBundleConfig("src/observable/index.ts", "./observable"),
]