tsdown.config.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import { defineConfig } from 'tsdown'
  2. /**
  3. * Package-shape override (see the root tsdown.config.ts): besides the
  4. * default lib/index.js bundle, the worker BOOTSTRAP ships as its own
  5. * sibling entry — `new Worker(new URL('./worker.js', import.meta.url))`
  6. * loads it as a file, so it cannot be part of the index bundle. TWO
  7. * single-entry builds, not one two-entry build: a multi-entry build emits
  8. * the shared bootstrap module as a `lib/bootstrap-*.js` chunk both bundles
  9. * import, which the package.json `files` whitelist (deliberately exact)
  10. * would omit from the packed artifact — each single-entry build inlines its
  11. * own bootstrap copy instead, keeping every shipped file self-contained.
  12. */
  13. export default defineConfig([
  14. {
  15. entry: ['lib/types/index.js'],
  16. outDir: 'lib',
  17. format: ['esm'],
  18. platform: 'node',
  19. target: 'es2024',
  20. fixedExtension: false,
  21. dts: false,
  22. clean: false,
  23. },
  24. {
  25. entry: ['lib/types/worker.js'],
  26. outDir: 'lib',
  27. format: ['esm'],
  28. platform: 'node',
  29. target: 'es2024',
  30. fixedExtension: false,
  31. dts: false,
  32. clean: false,
  33. },
  34. ])