Skip to content

v15.0.0 - ESM Support

Latest

Choose a tag to compare

@securingsincity securingsincity released this 29 Jul 12:29
334f49e

Closes #2122 and #1540

react-ace now ships a native ESM build alongside CommonJS. import AceEditor from "react-ace" resolves to real ES modules in modern bundlers and in Node — fixing default-import interop under Vite 8's stricter CommonJS handling (#2122).

  • New exports map with import/require conditions and per-format TypeScript declarations (lib/index.mjs + lib/index.d.mts for ESM, lib/index.js + lib/index.d.ts for CJS)
  • module field added for older bundlers; main/types unchanged for legacy tooling
  • Verified with publint and arethetypeswrong (green across node10, node16, and bundler resolution modes)

Breaking changes

  • Deep imports are no longer supported. The exports map only exposes the package root, so paths like react-ace/lib/ace no longer resolve. Import everything from the root instead:
    import AceEditor, { split as SplitEditor, diff as DiffEditor } from "react-ace";
  • These were never documented; most users are unaffected.
  • ace-builds now loads when react-ace is imported rather than lazily on first render. Bundle contents are unchanged (it was always included); if you want to defer loading, lazy-load react-ace itself, e.g. via React.lazy().

Other changes

  • The SSR window shim is gone — modern ace-builds evaluates cleanly without a window object, so server-side imports work with no globals mutation.
  • Fixed prop-types usage that would crash under Node's ESM loader (PropTypes.oneOfType is not a function).
  • Loading Ace from a CDN (window.ace) continues to work as before, as do the UMD bundles in dist/.