question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jsonMode.js:7 Uncaught ReferenceError: exports is not defined

See original GitHub issue

Describe the bug Console error for only json, html and css languages. For other languages it’s working fine.

jsonMode.js:7 Uncaught ReferenceError: exports is not defined
    at jsonMode.js:7
    at jsonMode.js:7
    at t._createAndEvalScript (loader.js:794)
    at loader.js:776
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:61)
(anonymous) @ jsonMode.js:7
(anonymous) @ jsonMode.js:7
t._createAndEvalScript @ loader.js:794
(anonymous) @ loader.js:739
readFileAfterClose @ internal/fs/read_file_context.js:61
htmlMode.js:7 Uncaught ReferenceError: exports is not defined
    at htmlMode.js:7
    at htmlMode.js:7
    at t._createAndEvalScript (loader.js:794)
    at loader.js:776
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:61)
(anonymous) @ htmlMode.js:7
(anonymous) @ htmlMode.js:7
t._createAndEvalScript @ loader.js:794
(anonymous) @ loader.js:739
readFileAfterClose @ internal/fs/read_file_context.js:61
cssMode.js:7 Uncaught ReferenceError: exports is not defined
    at cssMode.js:7
    at cssMode.js:7
    at t._createAndEvalScript (loader.js:794)
    at loader.js:776
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:61)

To Reproduce

Steps to reproduce the behavior:

  1. Go to ‘…’
  2. Click on ‘…’
  3. Scroll down to ‘…’
  4. See error

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):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
vicke4commented, Feb 21, 2021

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 json causes issues.

0reactions
Nausscommented, Oct 15, 2021

Hi, @Nick-Lucas, I’ve tried your solution and it kinda works. I get different editors working in my Electron app BUT I also get an error in the dev build. The error is: image It occurs in the last line of the webpacked renderer.dev.js which is:

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 ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught ReferenceError: exports is not defined in filed ...
Basically giving it what it wants, a global exports variable. With that my TypeScript (2.3.2) generated file (es6) loads. Share.
Read more >
Uncaught ReferenceError: exports is not defined : r/typescript
Getting this error for some dumb reason i'm sure. Uncaught ReferenceError: exports is not defined. at app.js:2. (anonymous) @ app.js:2. all ...
Read more >
How to fix ReferenceError: exports is not defined TypeScript
ReferenceError: exports is not defined. Solution. If you are getting the error for code that runs in the browser, try defining a global...
Read more >
worker-javascript.js ... _ - Code Metrics - Kaapiii/concrete5
The variable s seems to not be initialized for all possible execution paths. Are you sure call handles undefined variables? Loading history...
Read more >
"Fossies" - the Fresh Open Source Software Archive
defineProperties(r,n),r}}if, exports: factory,. (Object.defineProperty){var g=m({}),y=typeof document=="undefined"||m(document.c, initialized: true.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found