Build system work
This commit is contained in:
43
rollup.config.ts
Normal file
43
rollup.config.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
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"),
|
||||
]
|
||||
Reference in New Issue
Block a user