mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
34 lines
844 B
TypeScript
34 lines
844 B
TypeScript
import { defineConfig } from "tsup";
|
|
import { NodeResolvePlugin } from "@esbuild-plugins/node-resolve";
|
|
|
|
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: [
|
|
NodeResolvePlugin({
|
|
extensions: [".js", "ts", "tsx", "jsx"],
|
|
onResolved: (resolved) => {
|
|
if (resolved.includes("node_modules")) {
|
|
return {
|
|
external: true,
|
|
};
|
|
}
|
|
return resolved;
|
|
},
|
|
}),
|
|
],
|
|
esbuildOptions(options) {
|
|
options.keepNames = true;
|
|
options.banner = {
|
|
js: '"use client"',
|
|
};
|
|
},
|
|
onSuccess: options.watch ? "pnpm types" : undefined,
|
|
}));
|