tsup.config.ts 723 B

123456789101112131415161718192021222324252627282930
  1. import { defineConfig } from 'tsup'
  2. export default defineConfig(() => [
  3. {
  4. entry: ['src/*.ts'],
  5. outDir: 'dist',
  6. format: ['esm', 'cjs'],
  7. clean: true,
  8. minify: true,
  9. platform: 'browser',
  10. dts: {
  11. resolve: true
  12. }
  13. },
  14. {
  15. entry: { bundle: 'src/index.ts' },
  16. outDir: '../../core/tauri/scripts',
  17. format: ['iife'],
  18. globalName: '__TAURI_IIFE__',
  19. clean: false,
  20. minify: true,
  21. platform: 'browser',
  22. dts: false,
  23. // esbuild `globalName` option generates `var __TAURI_IIFE__ = (() => {})()`
  24. // and var is not guaranted to assign to the global `window` object so we make sure to assign it
  25. footer: {
  26. js: 'window.__TAURI__ = __TAURI_IIFE__'
  27. }
  28. }
  29. ])