tabby/clients/tabby-agent/tsup.config.ts

62 lines
1.3 KiB
TypeScript
Raw Normal View History

import { defineConfig } from "tsup";
import { polyfillNode } from "esbuild-plugin-polyfill-node";
2023-05-29 02:09:44 +00:00
import { dependencies } from "./package.json";
2023-05-29 02:09:44 +00:00
export default async () => [
defineConfig({
2023-06-06 14:25:31 +00:00
name: "node-cjs",
entry: ["src/index.ts"],
platform: "node",
format: ["cjs"],
sourcemap: true,
clean: true,
}),
defineConfig({
2023-06-06 14:25:31 +00:00
name: "browser-iife",
entry: ["src/index.ts"],
platform: "browser",
format: ["iife"],
globalName: "Tabby",
2023-06-06 14:25:31 +00:00
minify: true,
sourcemap: true,
2023-06-06 14:25:31 +00:00
esbuildPlugins: [
polyfillNode({
polyfills: { fs: true },
}),
],
clean: true,
}),
defineConfig({
2023-06-06 14:25:31 +00:00
name: "browser-esm",
entry: ["src/index.ts"],
platform: "browser",
format: ["esm"],
// FIXME: bundle all dependencies to reduce module resolving problems, not a good solution
noExternal: Object.keys(dependencies),
sourcemap: true,
esbuildPlugins: [
polyfillNode({
polyfills: { fs: true },
}),
],
clean: true,
}),
defineConfig({
name: "type-defs",
entry: ["src/index.ts"],
dts: {
only: true,
},
clean: true,
}),
defineConfig({
name: "cli",
entry: ["src/cli.ts"],
platform: "node",
2023-05-29 02:09:44 +00:00
noExternal: Object.keys(dependencies),
minify: true,
2023-06-06 14:25:31 +00:00
sourcemap: true,
clean: true,
}),
];