-
-
Notifications
You must be signed in to change notification settings - Fork 270
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
jsonMode.js:7 Uncaught ReferenceError: exports is not defined #87
Comments
Hello @saravanakumargn. |
@suren-atoyan Thanks for your response. I am facing this issue with ElectronJS. When I am trying to use JSON or HTML (loading from This is my Index.js config to load Monaco Editor.
Error only HTML and JSON
As this is ElectronJS app I couldn't generate codesandbox script. Kindly let me know if you need any additional details. |
Hello @saravanakumargn. I'll try to reproduce your case in my local machine to be able to debug it. Please, also provide me the electron configuration file content or the template/boilerplate in case if you used one to generate your project. |
@suren-atoyan Appreciate your response. I am using https://github.com/electron-react-boilerplate/electron-react-boilerplate for my project. You can reproduce in this way.
Note: I noticed when I am running |
Hello @saravanakumargn. I managed to reproduce your case and I saw the error. I think it's related to the boilerplate configuration you've used. I didn't notice it when we use monaco in electron applications. So, I am sorry, but I don't see anything from the point of view of the wrapper. |
hey @saravanakumargn were you able to resolve this issue in your dev environment? |
Unfortunately, this is the only reason stopping me from using this awesome lib. I can't figure out a fix for this, and the issue happens on production build also in my case. @suren-atoyan, I'm not using the template OP is using. Is there anything else I have to check? Other languages work just fine. Only |
I did some head banging on this and managed to come with a solution for Electron based on a slightly buried vanilla electron sample from Microsoft: basically do this: import { loader } from '@monaco-editor/react'
self.module = undefined
// if your typescript complains then just silence it:
self.module = undefined as unknown as NodeModule
// set up loader as normal I've tested it out in a dev and production build (electron-builder here) and nothing is functionally broken, though self.module seems to be a copy of global.module and it's not just electron modules in there, so I'm unsure of the ramifications of this monkey patching with regards to other libraries. |
Hi, @Nick-Lucas, I've tried your solution and it kinda works. module.exports = __webpack_exports__; The application seems to work fine after and the problem does not exists in prod. I'm guessing there should be a webpack way of solving this ? |
Describe the bug
Console error for only json, html and css languages. For other languages it's working fine.
To Reproduce
Steps to reproduce the behavior:
Or, please add a minimal code snippet to reproduce the issue, for example in codesandbox.
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help to explain your problem.
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: