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.

Does not work as a traditional JS resource – Uncaught ReferenceError: module is not defined

See original GitHub issue

Hello, this looks like a very handy library. However, I’m having trouble using it without using it as an ES-module.

My source code:

<script src="https://unpkg.com/quicklink@0.1.2/dist/quicklink.js"></script>
<script>
  quicklink();
</script>

The output:

quicklink.js:1 Uncaught ReferenceError: module is not defined
    at quicklink.js:1
(anonymous) @ quicklink.js:1
(index):142 Uncaught ReferenceError: quicklink is not defined
    at (index):142

Expected result I would expect it to work since the readme says so.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
lukeedcommented, Dec 14, 2018

Hey, for browser/UMD usage thru unpkg.com, you should use this asset: https://unpkg.com/quicklink@0.1.2/dist/quicklink.umd.js

The one you requested is the Node/CommonJS version

1reaction
lukeedcommented, Dec 14, 2018

For sure, will do – thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: module is not defined - Stack Overflow
So i have been trying to run this web ...
Read more >
Javascript, Uncaught ReferenceError: module is not defined
I've made a little program using JS and at the bottom I have: module.exports = functions; This is so that I can use...
Read more >
The JavaScript Modules Handbook – Complete Guide to ES ...
A JavaScript module is a file that allows you to export its code. ... So, it would not work in a function, for...
Read more >
Scoping with vanilla JS ES modules - Go Make Things
js // This will throw an error: // Uncaught ReferenceError: answer is not defined console.log(answer);. Similarly, you cannot access the name ...
Read more >
require is not defined in javascript - You.com | The AI Search ...
You are trying to run it in the browser, where it isn't supported and does not work. You need to run it in...
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