New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property 'acequire' of undefined #230
Comments
@jefflewis Are you using webpack to bundle? or something else? This is caused by |
Yes, I'm using webpack with rails to load my apps. I stuck a debugger point into I did notice that after running I've outlined my web pack configuration below. Let me know if I can be of any more help getting this sorted out. The following is my web pack config:
My loaders include babel:
|
👍 Can confirm this happens to me as well though I can't tell if this is a problem with how rails runs web pack or if it's this library. I used yarn to install the react-ace then I'm using react-ace in two different javascript/packs. The first one works but the second fails with the acequire error. |
+1 for me. I hit this on 5.1 with basic rails webpacker setup. |
This may be related to rails, it may not be. I'll try to reproduce by setting up a rails environment. have any of you @jimmybaker @frostpuppet @jefflewis tried installing |
I had installed brace separately, and so no change in behavior. |
I am using |
@securingsincity Spent an hour of so debugging this. It seems to me that there is some way react-ace is bundled that the parent project doesn't work with. I did try to install In the lib/ace.js file which is the entry point, if you throw a step debugger on this you can see that |
@securingsincity I am able to get a custom rollup of the code editor working with the code below & brace lib. Note the import React, { Component } from 'react';
import PropTypes from 'prop-types';
if (typeof window !== 'undefined') {
const ace = require('brace');
}
class CodeEditor extends Component {
componentDidMount() {
if (typeof window !== 'undefined') {
const {
editorId,
onChange,
setReadOnly,
setValue,
setOptions,
theme,
mode,
enableBasicAutocompletion,
enableLiveAutocompletion,
} = this.props;
require(`brace/mode/${mode}`);
require(`brace/theme/${theme}`);
const editor = ace.edit(editorId);
ace.require('ace/ext/language_tools');
this.editor = editor;
editor.getSession().setMode(`ace/mode/${mode}`);
editor.setTheme(`ace/theme/${theme}`);
editor.on('change', e => onChange(editor.getValue(), e));
editor.setReadOnly(setReadOnly);
editor.setValue(setValue);
editor.$blockScrolling = Infinity;
editor.setOptions({
enableBasicAutocompletion,
enableLiveAutocompletion,
...setOptions,
});
}
}
shouldComponentUpdate() {
return false;
}
render() {
const { className, style, editorId } = this.props;
return (
<div id={editorId} style={style} className={className}></div>
);
}
}
CodeEditor.propTypes = {
editorId: PropTypes.string,
className: PropTypes.string,
onChange: PropTypes.func,
setReadOnly: PropTypes.bool,
enableBasicAutocompletion: PropTypes.bool,
enableLiveAutocompletion: PropTypes.bool,
setValue: PropTypes.string,
theme: PropTypes.string,
mode: PropTypes.string,
style: PropTypes.object,
setOptions: PropTypes.object,
};
CodeEditor.defaultProps = {
editorId: 'ace-editor',
className: '',
onChange: () => {}, // (value, event)
setValue: '',
setReadOnly: false,
theme: 'github',
mode: 'javascript',
enableBasicAutocompletion: true,
enableLiveAutocompletion: true,
style: {
height: '300px',
width: '400px',
},
setOptions: {},
};
export default CodeEditor; |
I don't know if this is totally irrelevant, so I apologize if it is... But, I have the same issue with using swagger-editor which embeds ace. If I have not used the other version of ACE from this addon, it works fine. On the other hand, that version breaks (listeners on text changes are not invoked) if swagger-editor has been loaded first. In all cases, reloading the browser using F5 causes either swagger-editor or the aceeditor vaadin addon to work again if the opposite component was displayed first. |
Hi all given it's been quite some time and no activity on this issue, I am closing it. |
Problem
I am getting this same issue (RE: #141, #179, #187 ) on V5.0.1. I've destroyed node_modules, cleared yarn cache, reinstalled modules with yarn, and still get this error. The simplest hello world app will fail if I try to import AceEditor from 'react-ace' in the file.
What should I look for in trying to get this to work? Is this some sort compilation error with brace/react-ace?
I get the same error if I try to directly include the compiled JS file:import AceEditor from '../node_modules/react-ace/dist/react-ace.js'
Sample code to reproduce your issue
References
#141, #179, #187
The text was updated successfully, but these errors were encountered: