tsup.config.js 711 B

12345678910111213141516171819202122232425262728293031323334
  1. import { defineConfig } from "tsup";
  2. export default defineConfig((options) => [
  3. {
  4. entry: ["src/index.ts", "src/preset.ts"],
  5. splitting: false,
  6. minify: !options.watch,
  7. format: ["cjs", "esm"],
  8. dts: {
  9. resolve: true,
  10. },
  11. treeshake: true,
  12. sourcemap: true,
  13. clean: true,
  14. platform: "browser",
  15. esbuildOptions(options) {
  16. options.conditions = ["module"];
  17. },
  18. },
  19. {
  20. entry: ["src/postinstall.ts"],
  21. outDir: "./bin",
  22. splitting: false,
  23. minify: !options.watch,
  24. format: ["cjs"],
  25. treeshake: true,
  26. target: "node16",
  27. clean: true,
  28. platform: "node",
  29. esbuildOptions(options) {
  30. options.conditions = ["module"];
  31. },
  32. },
  33. ]);