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: module is not defined

See original GitHub issue

When I include kotlin-extensions in my HTML page, I get this error in all browsers:

Uncaught ReferenceError: module is not defined
    at kotlin-extensions.js:93
(anonymous) @ kotlin-extensions.js:93

This is line 93:

}(module.exports, require('kotlin'), require('core-js/library/fn/object/assign')));

The kotlin module is loaded, but core-js seems new to me. I could not find any documentation in the kotlin-extensions project which mentions core-js. As I include kotlin-extensions via gradle and I can not find anything core-js releated in the project, I assume the kotlin-extensions artifact is missing the dependency to core-js.

dependencies {
    compile(
        "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlinVersion",
        "org.jetbrains:kotlin-extensions:$kotlinExtensionsVersion",
        "org.jetbrains:kotlin-react:$kotlinReactVersion",
        "org.jetbrains:kotlin-react-dom:$kotlinReactVersion"
    )
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
Hypnosphicommented, Dec 12, 2019

I’m going to drop the core-js import. Make sure that you provide your own Object.assign polyfill if you’re using objectAssign and have to support IE11

1reaction
Leonyacommented, May 16, 2018

It does exist, you have to npm install core-js. If you’re not using npm we don’t have a solution at the moment, I’m afraid.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ReferenceError: module is not defined - Stack Overflow
You are mixing ES imports with CommonJS - at bottom of file you have module.exports = api; which is CJS terminology.
Read more >
Module is not defined in ES module scope in JavaScript
The error "Module is not defined in ES module scope" occurs when we try to use the module.exports CommonJS syntax in ES modules....
Read more >
module is not defined in ES module scope (with sveltekit ...
I can't figure out how to use playwright with sveltekit (no typescript). I get: ReferenceError: module is not defined in ES module scope...
Read more >
Uncaught ReferenceError: module is not defined - Laracasts
Javascript doesn't understand module exporting or importing per default. Although it is documented and scoped within ES2015, almost no browser can use it...
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 >

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