tsdown.config.ts 974 B

12345678910111213141516171819202122232425262728293031
  1. import { defineConfig } from 'tsdown'
  2. /**
  3. * ui-primitives is browser-only, but its lib bundle IS imported under plain
  4. * Node now that the web shell is a lib (dsh-client-web's lib chain reaches
  5. * this package). CSS imports are therefore stubbed to empty modules instead
  6. * of externalized — the hashed class maps only matter in bundler contexts
  7. * (loader module table / vite source paths), which compile src directly and
  8. * never read lib.
  9. */
  10. export default defineConfig({
  11. entry: ['lib/types/index.js', 'lib/types/invariant.js'],
  12. outDir: 'lib',
  13. format: ['esm'],
  14. platform: 'neutral',
  15. target: 'es2024',
  16. fixedExtension: false,
  17. dts: false,
  18. clean: false,
  19. plugins: [{
  20. name: 'dsh-css-stub',
  21. resolveId(source: string) {
  22. if (!source.endsWith('.css')) return null
  23. return `\0dsh-css-stub:${source}.mjs`
  24. },
  25. load(id: string) {
  26. if (!id.startsWith('\0dsh-css-stub:')) return null
  27. return 'export default {};'
  28. },
  29. }],
  30. })