v8 起不再支持 Brace,需按迁移文档改用 ace-builds;mode、theme、ext-language_tools 等要单独 import 对应 ace-builds 模块,否则不生效;AceEditor 需传唯一的 name 作为容器 id

react-ace
securingsincityMIT活跃维护把 Ace 代码编辑器封装成 React 组件,方便在 React 项目里直接嵌入带语法高亮和编辑能力的代码编辑区。
React Ace Component
npm install react-ace ace-buildsREADME 未说明,纯前端浏览器运行,无 GPU 或显存要求
把 Ace 代码编辑器封装成 React 组件,省去手动挂载和同步状态的麻烦
把 Ace 代码编辑器封装成 React 组件,方便在 React 项目里直接嵌入带语法高亮和编辑能力的代码编辑区。
核心能力
- 提供 AceEditor 组件,用 mode 和 theme 属性配置语言与主题
- 支持 Split 分屏编辑器和 Diff 对比编辑器组件
- 通过 onChange 回调把编辑器内容变化同步给 React
- v8 起改用 ace-builds,不再依赖 Brace
容易踩的坑
- v15.0.0v15.0.0 - ESM Support最新正式版2026-07-29 · 2026-07-29 12:29 UTC
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/.
- v14.1.02026-07-29 · 2026-07-29 12:02 UTC
查看更新说明
What's Changed
- Fix handling of a null or absent "markers" property by @vog in https://github.com/securingsincity/react-ace/pull/2110
- #2111 Adding to onFocus event for Split editor, the index of the editor focused by @vagostep in https://github.com/securingsincity/react-ace/pull/2112
- Vite Upgrade by @securingsincity in https://github.com/securingsincity/react-ace/pull/2114
- Replace deprecated packages by @itkrt2y in https://github.com/securingsincity/react-ace/pull/2118
- Upgrade dependencies and build pipeline by @securingsincity in https://github.com/securingsincity/react-ace/pull/2124
New Contributors
- @vog made their first contribution in https://github.com/securingsincity/react-ace/pull/2110
- @vagostep made their first contribution in https://github.com/securingsincity/react-ace/pull/2112
- @itkrt2y made their first contribution in https://github.com/securingsincity/react-ace/pull/2118
Full Changelog: https://github.com/securingsincity/react-ace/compare/v14.0.1...v14.1.0
- v14.0.12025-02-11 · 2025-02-11 02:51 UTC
查看更新说明
React 19 support Full Changelog: https://github.com/securingsincity/react-ace/compare/v14.0.0...v14.0.1
- v13.0.02024-11-02 · 2024-11-02 02:23 UTC
查看更新说明
What's Changed
- Bugfix:
showInvisiblestype by @rickdunkin in https://github.com/securingsincity/react-ace/pull/2037 - bump ace-builds up to 1.36.3 and added their new enableMobileMenu option by @Curtisjnes in https://github.com/securingsincity/react-ace/pull/2038
- Chore(deps): Bump the npm_and_yarn group with 3 updates by @dependabot in https://github.com/securingsincity/react-ace/pull/2036
- Chore(deps-dev): Bump @types/react from 18.3.3 to 18.3.8 by @dependabot in https://github.com/securingsincity/react-ace/pull/2035
- Chore(deps-dev): Bump babel-loader from 9.1.3 to 9.2.1 by @dependabot in https://github.com/securingsincity/react-ace/pull/2031
- Chore(deps-dev): Bump @types/prop-types from 15.7.12 to 15.7.13 by @dependabot in https://github.com/securingsincity/react-ace/pull/2030
- Chore(deps-dev): Bump @types/node from 20.14.7 to 22.5.5 by @dependabot in https://github.com/securingsincity/react-ace/pull/2029
- Chore(deps-dev): Bump husky from 9.0.11 to 9.1.6 by @dependabot in https://github.com/securingsincity/react-ace/pull/2027
- Chore(deps-dev): Bump typescript from 5.5.2 to 5.6.2 by @dependabot in https://github.com/securingsincity/react-ace/pull/2026
- Chore(deps-dev): Bump webpack-dev-server from 5.0.4 to 5.1.0 by @dependabot in https://github.com/securingsincity/react-ace/pull/2023
- Chore(deps-dev): Bump @testing-library/react from 16.0.0 to 16.0.1 by @dependabot in https://github.com/securingsincity/react-ace/pull/2019
- Chore(deps-dev): Bump @babel/cli from 7.24.7 to 7.25.6 by @dependabot in https://github.com/securingsincity/react-ace/pull/2018
- Chore(deps-dev): Bump @types/chai from 4.3.16 to 4.3.19 by @dependabot in https://github.com/securingsincity/react-ace/pull/2016
- Chore(deps-dev): Bump jsdom from 24.1.0 to 25.0.0 by @dependabot in https://github.com/securingsincity/react-ace/pull/2013
- Chore(deps-dev): Bump @babel/preset-env from 7.24.7 to 7.25.4 by @dependabot in https://github.com/securingsincity/react-ace/pull/2011
- Chore(deps-dev): Bump webpack from 5.92.1 to 5.94.0 by @dependabot in https://github.com/securingsincity/react-ace/pull/2010
- Chore(deps-dev): Bump @types/lodash from 4.17.5 to 4.17.7 by @dependabot in https://github.com/securingsincity/react-ace/pull/1979
- Chore(deps-dev): Bump prettier from 3.3.2 to 3.3.3 by @dependabot in https://github.com/securingsincity/react-ace/pull/1976
- Chore(deps-dev): Bump rimraf from 5.0.7 to 6.0.1 by @dependabot in https://github.com/securingsincity/react-ace/pull/1971
- Chore(deps): Bump the npm_and_yarn group with 2 updates by @dependabot in https://github.com/securingsincity/react-ace/pull/2039
- Chore(deps-dev): Bump @babel/core from 7.24.7 to 7.26.0 by @dependabot in https://github.com/securingsincity/react-ace/pull/2040
New Contributors
- @rickdunkin made their first contribution in https://github.com/securingsincity/react-ace/pull/2037
- @Curtisjnes made their first contribution in https://github.com/securingsincity/react-ace/pull/2038
Full Changelog: https://github.com/securingsincity/react-ace/compare/v12.0.0...v13.0.0
- Bugfix:
- v12.0.02024-06-25 · 2024-06-25 01:25 UTC
查看更新说明
What's Changed
- Chore(deps-dev): Bump typescript from 5.4.3 to 5.5.2 by @dependabot in https://github.com/securingsincity/react-ace/pull/1959
- Chore(deps-dev): Bump webpack from 5.91.0 to 5.92.1 by @dependabot in https://github.com/securingsincity/react-ace/pull/1956
- Chore(deps): Bump ace-builds from 1.32.8 to 1.35.0 by @dependabot in https://github.com/securingsincity/react-ace/pull/1946
- Chore(deps-dev): Bump @types/node from 20.11.30 to 20.14.7 by @dependabot in https://github.com/securingsincity/react-ace/pull/1958
- Chore(deps-dev): Bump prettier from 3.2.5 to 3.3.2 by @dependabot in https://github.com/securingsincity/react-ace/pull/1947
- Chore(deps-dev): Bump express from 4.19.1 to 4.19.2 by @dependabot in https://github.com/securingsincity/react-ace/pull/1856
- Chore(deps-dev): Bump react-test-renderer from 18.2.0 to 18.3.1 by @dependabot in https://github.com/securingsincity/react-ace/pull/1893
- Chore(deps-dev): Bump react and @types/react by @dependabot in https://github.com/securingsincity/react-ace/pull/1920
- Chore(deps-dev): Bump jsdom from 24.0.0 to 24.1.0 by @dependabot in https://github.com/securingsincity/react-ace/pull/1923
- Chore(deps-dev): Bump @testing-library/react from 14.2.2 to 16.0.0 by @dependabot in https://github.com/securingsincity/react-ace/pull/1936
- Chore(deps-dev): Bump @babel/cli from 7.24.1 to 7.24.7 by @dependabot in https://github.com/securingsincity/react-ace/pull/1937
- Chore(deps-dev): Bump @babel/core from 7.24.3 to 7.24.7 by @dependabot in https://github.com/securingsincity/react-ace/pull/1938
- Chore(deps-dev): Bump braces from 3.0.2 to 3.0.3 by @dependabot in https://github.com/securingsincity/react-ace/pull/1949
- Update types.ts to match ace-builds by @gchallen in https://github.com/securingsincity/react-ace/pull/1898
this.editornull check by @sandragg in https://github.com/securingsincity/react-ace/pull/1884- Add readOnly property to ICommand interface by @kalczur in https://github.com/securingsincity/react-ace/pull/1881
- Chore(deps-dev): Bump eslint-plugin-react from 7.34.1 to 7.34.3 by @dependabot in https://github.com/securingsincity/react-ace/pull/1955
- Chore(deps-dev): Bump @babel/preset-react from 7.24.1 to 7.24.7 by @dependabot in https://github.com/securingsincity/react-ace/pull/1943
- Chore(deps-dev): Bump @babel/preset-env from 7.24.3 to 7.24.7 by @dependabot in https://github.com/securingsincity/react-ace/pull/1942
- Chore(deps-dev): Bump @babel/register from 7.23.7 to 7.24.6 by @dependabot in https://github.com/securingsincity/react-ace/pull/1925
- Chore(deps-dev): Bump @babel/preset-typescript from 7.24.1 to 7.24.7 by @dependabot in https://github.com/securingsincity/react-ace/pull/1939
- Chore(deps-dev): Bump @testing-library/jest-dom from 6.4.2 to 6.4.6 by @dependabot in https://github.com/securingsincity/react-ace/pull/1945
- Chore(deps-dev): Bump react-dom and @types/react-dom by @dependabot in https://github.com/securingsincity/react-ace/pull/1894
- Chore(deps-dev): Bump rimraf from 5.0.5 to 5.0.7 by @dependabot in https://github.com/securingsincity/react-ace/pull/1909
- Chore(deps-dev): Bump eslint from 8.57.0 to 9.5.0 by @dependabot in https://github.com/securingsincity/react-ace/pull/1951
- Chore(deps-dev): Bump @types/lodash from 4.17.0 to 4.17.5 by @dependabot in https://github.com/securingsincity/react-ace/pull/1944
- Chore(deps-dev): Bump @types/chai from 4.3.14 to 4.3.16 by @dependabot in https://github.com/securingsincity/react-ace/pull/1902
New Contributors
- @sandragg made their first contribution in https://github.com/securingsincity/react-ace/pull/1884
- @kalczur made their first contribution in https://github.com/securingsincity/react-ace/pull/1881
Full Changelog: https://github.com/securingsincity/react-ace/compare/v11.0.1...v12.0.0
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
React-Ace

A set of react components for Ace
NOTE FOR VERSION 8! : We have stopped support for Brace and now use Ace-builds. Please read the documentation on how to migrate. Examples are being updated.
DEMO of React Ace Split Editor
Install
npm install react-ace ace-builds
yarn add react-ace ace-builds
Basic Usage
import React from "react";
import { render } from "react-dom";
import AceEditor from "react-ace";
import "ace-builds/src-noconflict/mode-java";
import "ace-builds/src-noconflict/theme-github";
import "ace-builds/src-noconflict/ext-language_tools";
function onChange(newValue) {
console.log("change", newValue);
}
// Render editor
render(
<AceEditor
mode="java"
theme="github"
onChange={onChange}
name="UNIQUE_ID_OF_DIV"
editorProps={{ $blockScrolling: true }}
/>,
document.getElementById("example")
);
Examples
Checkout the example directory for a working example using webpack.
Documentation
How to add modes, themes and keyboard handlers
Backers
Support us with a monthly donation and help us continue our activities. [Become a backer]
Sponsors
Become a sponsor and get your logo on our README on Github with a link to your site. [Become a sponsor]