Closed princefishthrower closed 3 years ago
It was an issue with the beforeMount
vs onMount
callback in the Editor
component I was using. If I use the onMount
callback, a normal import
statement works just fine:
import GitHub from "monaco-themes/themes/GitHub.json"
...
<Editor onMount={(_editor, monaco) => {
monaco.editor.defineTheme("GitHub", GitHub)
monaco.editor.setTheme("GitHub")
}}/>
Note here the import name GitHub
can actually take on any name since it just represents the imported JSON for the theme.
Sorry for my mistake!
Actually I'm rather confused. The provided example in the docs of course works:
When I trying to import the theme at the top of the file, it won't work. I've tried way:
None set the theme. Is there any way to get the
import
orrequire
way of doing things working? I don't like usingimport
within the body of my React components.To be honest I've never even seen the
import("").then()
syntax ever before.