Co-authored-by: Julien Valverdé <julien.valverde@mailo.com> Reviewed-on: https://git.jvalver.de/Thilawyn/traitify-ts/pulls/1
This commit was merged in pull request #1.
This commit is contained in:
@@ -5,30 +5,40 @@ import ts from "rollup-plugin-ts"
|
||||
import pkg from "./package.json" assert { type: "json" }
|
||||
|
||||
|
||||
export default defineConfig({
|
||||
input: "src/index.ts",
|
||||
export const createBundleConfig = (
|
||||
input: string,
|
||||
name: keyof typeof pkg.exports,
|
||||
) => (
|
||||
defineConfig({
|
||||
input,
|
||||
|
||||
output: [
|
||||
{
|
||||
file: pkg.exports["."].import.default,
|
||||
format: "esm",
|
||||
},
|
||||
output: [
|
||||
{
|
||||
file: pkg.exports[name].import.default,
|
||||
format: "esm",
|
||||
},
|
||||
{
|
||||
file: pkg.exports[name].require.default,
|
||||
format: "cjs",
|
||||
},
|
||||
],
|
||||
|
||||
{
|
||||
file: pkg.exports["."].require.default,
|
||||
format: "cjs",
|
||||
},
|
||||
],
|
||||
external: id => !/^[./]/.test(id),
|
||||
|
||||
external: id => !/^[./]/.test(id),
|
||||
plugins: [
|
||||
nodeResolve(),
|
||||
ts(),
|
||||
|
||||
plugins: [
|
||||
nodeResolve(),
|
||||
ts(),
|
||||
cleanup({
|
||||
comments: "jsdoc",
|
||||
extensions: ["ts"],
|
||||
}),
|
||||
],
|
||||
})
|
||||
)
|
||||
|
||||
cleanup({
|
||||
comments: "jsdoc",
|
||||
extensions: ["ts"],
|
||||
}),
|
||||
],
|
||||
})
|
||||
|
||||
export default [
|
||||
createBundleConfig("src/lib.ts", "."),
|
||||
createBundleConfig("src/util/lib.ts", "./util"),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user