openpanel/packages/react-hook-form/tsup.config.ts
Stefan Pejcic 09f9f9502d packages
2024-11-07 19:03:37 +01:00

24 lines
695 B
TypeScript

import { defineConfig } from "tsup";
import { lodashReplacePlugin } from "../shared/lodash-replace-plugin";
import { markAsExternalPlugin } from "../shared/mark-as-external-plugin";
export default defineConfig((options) => ({
entry: ["src/index.ts"],
splitting: false,
sourcemap: true,
clean: false,
minify: true,
format: ["cjs", "esm"],
outExtension: ({ format }) => ({ js: format === "cjs" ? ".cjs" : ".mjs" }),
platform: "browser",
esbuildPlugins: [lodashReplacePlugin, markAsExternalPlugin],
esbuildOptions(options) {
options.keepNames = true;
options.banner = {
js: '"use client"',
};
},
onSuccess: options.watch ? "pnpm types" : undefined,
}));