Skip to content
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

ace is not defined in production only #1870

Open
wendymungovan opened this issue Apr 9, 2024 · 0 comments
Open

ace is not defined in production only #1870

wendymungovan opened this issue Apr 9, 2024 · 0 comments

Comments

@wendymungovan
Copy link

wendymungovan commented Apr 9, 2024

ace not defined in nodejs production mode build

Only in nodejs production mode get uncaught ReferenceError: ace is not defined. Everything works find in dev mode build.

image

Error is thrown but everything seems to work as expected.

Sample code to reproduce your issue

package.json

...
 "ace-builds": "1.32.9",
 "react-ace": "11.0.1",
 "react": "18.2.0",
 "webpack": "5.91.0",
...

import { useRef, useState, useEffect } from "react";
import "react-ace";
import AceEditor from "react-ace";
import 'ace-builds';
import 'ace-builds/webpack-resolver';
import "ace-builds/src-noconflict/keybinding-vim";
import "ace-builds/src-noconflict/mode-xml";
import "ace-builds/src-noconflict/theme-twilight";
import "ace-builds/src-noconflict/ext-language_tools.js";


// using react functional components
...
return (
<div>
   <AceEditor
         ref={editorRef}
         mode="xml"
onChange={handleOnChange}
          setOptions={{
            enableBasicAutocompletion: true,
            enableLiveAutocompletion: true,
            enableSnippets: true,
            maxLines: Infinity,
            fontFamily: "Source Code Pro"
          }}
          commands={commands}
         value={xml}
        />
</div>
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant