Try to setOption useWorker: false
<AceEditor
mode="json"
theme="github"
onChange={onChange}
name="UNIQUE_ID_OF_DIV"
editorProps={{ $blockScrolling: true }}
setOptions={{
useWorker: false
}}
/>
Answer from Honey on Stack Overflownpm
npmjs.com › package › react-ace
react-ace - npm
A react component for Ace Editor. Latest version: 14.0.1, last published: a year ago. Start using react-ace in your project by running `npm i react-ace`. There are 788 other projects in the npm registry using react-ace.
» npm install react-ace
Published Feb 11, 2025
Version 14.0.1
Author James Hrisho
Repository https://github.com/securingsincity/react-ace
Top answer 1 of 5
9
Try to setOption useWorker: false
<AceEditor
mode="json"
theme="github"
onChange={onChange}
name="UNIQUE_ID_OF_DIV"
editorProps={{ $blockScrolling: true }}
setOptions={{
useWorker: false
}}
/>
2 of 5
6
From my understanding, you would need to do either way to resolve the worker problem.
- Import this
ace-builds/webpack-resolver:
import AceEditor from "react-ace";
import "ace-builds/src-noconflict/mode-json";
import "ace-builds/src-noconflict/theme-github";
import 'ace-builds/webpack-resolver';
- Use
file-loaderto loadworker-jsonfile & then configure ace worker:
import AceEditor from "react-ace";
import "ace-builds/src-noconflict/mode-json";
import "ace-builds/src-noconflict/theme-github";
import ace from "ace-builds";
// `webpack` would return the url for `worker-json.js`
// then we use it to configure `ace`
import jsonWorkerUrl from "file-loader!ace-builds/src-noconflict/worker-json";
ace.config.setModuleUrl("ace/mode/json_worker", jsonWorkerUrl);
GitHub
github.com › securingsincity › react-ace › issues › 725
Could not load worker · Issue #725 · securingsincity/react-ace
June 19, 2019 - I see Could not load worker warning in the browser console. ... import React from "react"; import ReactDOM from "react-dom"; import AceEditor from "react-ace"; import "ace-builds/src-noconflict/ace"; import "ace-builds/src-noconflict/mode-json"; import "ace-builds/src-noconflict/theme-github"; let text = '{\n "id": 0,\n ' + '"script": """\n function add(x, y) {\n return x + y;\n }\n add(1, 2);\n """' + ',\n "descr": "add two numbers"\n}'; function App() { return ( <div className="App"> <h1>Code Editor Demo</h1> <AceEditor mode="json" theme="github" onChange={(value, stat) => { console.log("onChange", value, stat); }} value={text} name="UNIQUE_ID_OF_DIV" editorProps={{ $blockScrolling: true }} /> </div> ); } const rootElement = document.getElementById("root"); ReactDOM.render(<App />, rootElement);
Author sergibondarenko
GitHub
github.com › securingsincity › react-ace
GitHub - securingsincity/react-ace: React Ace Component · GitHub
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. ... 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") );
Starred by 4.2K users
Forked by 606 users
Languages TypeScript 74.3% | JavaScript 23.6% | HTML 2.0% | CSS 0.1%
CodeSandbox
codesandbox.io › s › ace-worker-3-vrr68
ace worker 3 - CodeSandbox
January 29, 2020 - ace worker 3 by sergibondarenko using ace-builds, prop-types, react, react-ace, react-dom, react-scripts
GitHub
github.com › securingsincity › react-ace › issues › 275
Disable annotations (useWorker not working) · Issue #275 · securingsincity/react-ace
April 12, 2017 - <AceEditor value={code} mode="javascript" theme="github" showLineNumbers readOnly editorProps={{ $useWorker: false, }} setOptions={{ useWorker: false }} />
Author JasonEtco
Medium
sumn2u.medium.com › code-editor-with-preview-in-browser-953323818d21
Code Editor with Preview in Browser | by Suman Kunwar | Medium
January 5, 2023 - const ace = require('ace-builds/src-noconflict/ace'); ace.config.set("basePath", "https://cdn.jsdelivr.net/npm/ace-builds@1.4.3/src-noconflict/"); ace.config.setModuleUrl('ace/mode/javascript_worker', "https://cdn.jsdelivr.net/npm/ace-builds@1.4.3/src-noconflict/worker-javascript.js"); Now if there’s an error, it will show you a piece of nice descriptive information about the error. Let’s sum up our code: In this way, we can embed the react-ace editor in our application and have a preview of the result.
GitHub
github.com › securingsincity › react-ace › issues › 483
Manual annotations removed by worker · Issue #483 · securingsincity/react-ace
const Editor = ({ annotations: customAnnotations = [], value }) => { const [annotations, setAnnotations] = useState([]); const [editor, setEditor] = useState(); const nextAnnotations = [ ...annotations.filter(({ custom }) => !custom), // annotations by worker ...customAnnotations.map((annotation) => ({ ...annotation, custom: true })) // flag for exclusion ]; useEffect(() => { if (editor) { editor.getSession().setAnnotations(nextAnnotations); } }, [editor, JSON.stringify(nextAnnotations)]); return ( <ReactAce mode="html" onLoad={setEditor} onValidate={setAnnotations} setOptions={{ useWorker: tr
Stack Overflow
stackoverflow.com › questions › 43358714 › react-ace-editor-causes-content-security-policy-error
react-ace editor causes content security policy error
Note that 'worker-src' was not explicitly set, so 'default-src' is used as a fallback. ... ace tries to create a webworker for html syntax checking which is blocked by csp due to the rule allowing self and data.
GitHub
github.com › securingsincity › react-ace › issues › 1327
Can not configure JSHint options in worker scripts · Issue #1327 · securingsincity/react-ace
I'm trying configure JSHint options for worker script. we have import 'ace-builds/webpack-resolver'; which takes woker scripts from ace-build. But we want to configure some rules for JSHint when it loads worker scripts. E.g. for javascript mode, we want to change rule esnext: true to esversion: 11. import React from 'react'; import Editor from 'react-ace'; import 'ace-builds/webpack-resolver'; import 'ace-builds/src-noconflict/theme-solarized_dark'; import 'ace-builds/src-noconflict/ext-language_tools'; export default class CodeEditor extends React.Component { constructor(props) { super(props)
CodeSandbox
codesandbox.io › examples › package › react-ace
react-ace examples - CodeSandbox
AboutA react component for Ace Editor654,677Weekly Downloads · Latest version14.0.1 · LicenseMIT · External Links · github.com/securingsincity/react-ace#readme · github.com/securingsincity/react-ace/issues ·
CodePen
codepen.io › romseguy › pen › LGYxNj
React wrapper for Ace.js
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing. If active, Pens will autosave every 30 seconds after being saved once. If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update. If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting. ... Visit your global Editor Settings. ... class AceEditor extends React.Component { static propTypes = { mode: React.PropTypes.string, content: React.PropTypes.string, }; static defaultProps = { mode: 'javas
Stack Overflow
stackoverflow.com › questions › tagged › react-ace
Newest 'react-ace' Questions - Stack Overflow
I'm adding a custom auto-completer to Ace. I have it working just fine as such, except my custom auto-completer is only called every few keypresses, which doesn't really work in practice. For example, ... ... I found myself on a React project that uses the Scorm API to interface with the Canvas LMS.
Openbase
openbase.com › js › react-ace
react-ace: Docs, Community, Tutorials, Reviews | Openbase
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. ... 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") );
Npm
npm.io › package › react-ace
React-ace NPM | npm.io
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. ... 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") );