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

How to dynamically import modes and themes ? #1853

Open
knoxnoe opened this issue Mar 27, 2024 · 0 comments
Open

How to dynamically import modes and themes ? #1853

knoxnoe opened this issue Mar 27, 2024 · 0 comments

Comments

@knoxnoe
Copy link

knoxnoe commented Mar 27, 2024

Problem

How to dynamically import modes and themes ?

Unable to infer path to ace from script src,", "use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes", "or with webpack use ace/webpack-resolver

Context

  • VIte
  • React
  • Typescript

Sample code to reproduce your issue

import AceEditor from "react-ace";
import "./App.css";

// Method 1:
// import "ace-builds/src-noconflict/mode-java";
// import "ace-builds/src-noconflict/theme-github";
// import "ace-builds/src-noconflict/ext-language_tools";

// Method 2:
// xxxx how to dynamic import mode or theme

function App() {
  return (
    <>
      <AceEditor
        mode="java"
        theme="github"
        name="UNIQUE_ID_OF_DIV"
        editorProps={{ $blockScrolling: true }}
      />
    </>
  );
}

export default App;

References

Progress on: #
codesandbox

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