React-ace: Cannot find es5-shim dependency from ace-builds/worker-*

Created on 11 Dec 2019  ·  3Comments  ·  Source: securingsincity/react-ace

Problem

I'm trying to update React-Ace to version 8 and i can't get the worker working.

/node_modules/ace-builds/src-min-noconflict/worker-css.js:1:2821: Cannot resolve dependency 'ace/lib/es5-shim'
image

I've seen people saying that it can be fixed by importing a webpack ace-build package but i'm using parcel not webpack

References

import AceEditor from 'react-ace';
import 'ace-builds/src-noconflict/worker-json';
import 'ace-builds/src-noconflict/mode-json';
import 'ace-builds/src-noconflict/theme-github';
import 'ace-builds/src-noconflict/ext-searchbox';
render() {
    <AceEditor
        mode='json'
        fontSize={14}
        theme='github'
        value={value}
        onChange={this.onChange}
        editorProps={{ $blockScrolling: true }}
        setOptions={{
            minLines: 4,
            maxLines: 30,
            enableBasicAutocompletion: true,
            enableLiveAutocompletion: true,
            enableSnippets: false,
            showLineNumbers: true,
            tabSize: 4,
            useWorker: true,
        }}
    />
}

Thanks :)

bug

Most helpful comment

I'm having the same issue with worker-javascript.

All 3 comments

I'm having the same issue with worker-javascript.

any solution for this issue ??

Kind of figured out a workaround (at least it's no longer a blocker at the moment)

Add the following to package.json https://en.parceljs.org/module_resolution.html#aliases

  "alias": {
    "ace/lib/es5-shim": "ace-builds/src-noconflict/ace.js"
  }

You'll also need to copy whatever worker-*.js files you need from node_modules/ace-builds/src-noconflict to the /dist folder.

Not sure why, but at least it builds and runs. 🤷‍♂️

Was this page helpful?
0 / 5 - 0 ratings