Getting JSX to work inside Monaco
See original GitHub issueHi,
I was wondering the steps necessary to get JSX to compile inside a Monaco editor. I added the React.d.ts file using monaco.languages.typescript.typescriptDefaults.addExtraLib
but I still get an compiler error when doing something as simple as this Cannot find name div
:

I noticed you don’t use monaco.languages.typescript.typescriptDefaults.addExtraLib
. How do you get the user’s ever changing TS files into alm in general?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
How to Embed a Monaco Editor in a React App | by Jennifer Fu
The work environment is ready. Embed a Monaco Editor Inside React App. Indeed, it takes one line of code to use the Monaco...
Read more >@monaco-editor/react - npm
Monaco Editor for React - use the monaco-editor in any React application ... Simple usage; Get value; editor instance; monaco instance ...
Read more >JSX Support in Microsoft's Monaco editor - Stack Overflow
Hey again, I'm trying to understand your instructions but having trouble on step 3: add JSX definitions as a monaco model. You use...
Read more >Building a code editor with Monaco - Expo Blog
I work on Snack, an online code editor for React Native apps. In the past, Snack's code ... Monaco provides an API to...
Read more >How to Build a Code Editor with React that Compiles and ...
This line of code is responsible for actually changing the themes inside a Monaco Editor code window. The defineTheme function gets called with ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Gotcha, makes sense, thanks!
TSC can indeed parse them. You need to set
jsx: react
flag in the config and make sure the file extension.tsx
is captured when adding the file to the compilation context.Note I am unaware / unskilled in doing language analysis inside monaco. I just use TypeScript / TypeScript compiler API directly 🌹