tsdown.config.ts 1019 B

12345678910111213141516171819202122232425262728293031323334
  1. import { defineConfig } from 'tsdown'
  2. /**
  3. * The engine ships two runtime entries: the engine service (index) and the
  4. * worker-thread entry (worker) the engine spawns via `new Worker`. The
  5. * entries are JS emitted by tsc under lib/types and are bundled as two
  6. * single-entry passes so shared modules (realm, runtime, session) are inlined
  7. * into each instead of split into a hash-named chunk (the worker entry must
  8. * be a self-contained file the Worker constructor can load by path). The
  9. * worker bundle is CommonJS because pkg's VFS Worker hook compiles
  10. * filesystem-string entries as CommonJS.
  11. */
  12. export default defineConfig([
  13. {
  14. entry: ['lib/types/index.js'],
  15. outDir: 'lib',
  16. format: ['esm'],
  17. platform: 'node',
  18. target: 'es2024',
  19. fixedExtension: false,
  20. dts: false,
  21. clean: false,
  22. },
  23. {
  24. entry: ['lib/types/worker.js'],
  25. outDir: 'lib',
  26. format: ['cjs'],
  27. platform: 'node',
  28. target: 'es2024',
  29. fixedExtension: false,
  30. dts: false,
  31. clean: false,
  32. },
  33. ])