tsup.config.ts 866 B

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