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.

Uncaught ReferenceError: exports is not defined

See original GitHub issue

version :beta0.264 myscript.js code exports.setText = function() { var el= document.getElementbyId('demo') el.innerHTML = 'hello'; }; html code `<!DOCTYPE html>

<html> <head> <title>random number</title> </head> <body>
<h1>test login </h1>

<p id="demo">
    test tcp
</p>

<button type="button" onclick='sendlidardata()'>login</button>
<button type="button" onclick='testFunction()'>test</button>

<script type="text/javascript" language="javascript" src='./myscript.js'>
        var myscript = require('./myscript.js');
        // 将`el`元素传入Node函数
        myscript.setText();
        // "hello"将显示在`el`标签中
    </script>
</body> </html>` then ,I get an error ,Uncaught ReferenceError: exports is not defined Thankyou ,I am a new one .hope your answer.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Christywlcommented, Nov 8, 2017

@Ants-double , please try oliverlife’s advice. It’s ok for me.

1reaction
oliverlifecommented, Nov 7, 2017

change <script type="text/javascript" language="javascript" src='./myscript.js'> to <script type="text/javascript" language="javascript">

Read more comments on GitHub >

github_iconTop Results From Across the Web

Typescript ReferenceError: exports is not defined
I had the error "exports is not defined" coming from an imported NPM module. Changing my typescript config did nothing as I had...
Read more >
How to fix ReferenceError: exports is not defined TypeScript
If you are getting the error for code that runs in the browser, try defining a global exports variable above the script tags...
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 >
exports is not defined" in browser : WEB-26773
Typescript compiler outputs wrong javascript module format, giving "ReferenceError: exports is not defined" in browser ; "use strict"; Object.defineProperty ...
Read more >
visual studio typescript "Uncaught ReferenceError: exports is ...
HTML : visual studio typescript " Uncaught ReferenceError: exports is not defined at.
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