jsmind icon indicating copy to clipboard operation
jsmind copied to clipboard

feat: add multiple build output formats (ES/CJS/UMD)

Open UmbraCi opened this issue 4 months ago • 0 comments

Summary

This PR adds support for multiple build output formats to better serve different use cases.

Changes

  • Configure Rollup to generate three output formats:
    • ES Module () - for modern bundlers with tree-shaking support
    • CommonJS () - for require/legacy toolchains
    • UMD () - for direct usage with global variables
  • Update package.json:
    • Set main to CommonJS entry
    • Set module to ES Module entry
    • Add unpkg fields for CDN usage
    • Update exports field to support conditional imports
    • Add all output directories to files field
  • Update .gitignore to exclude build outputs

Benefits

  • Modern bundlers can use ES modules for better tree-shaking
  • Legacy tools can continue using CommonJS
  • CDN users can directly include UMD builds via <script> tags
  • Better compatibility across different environments

Testing

  • ✅ Build succeeds and generates all three formats
  • ✅ All formats include source maps
  • ✅ Main library and plugins are built in all formats

UmbraCi avatar Oct 22 '25 06:10 UmbraCi