Uncaught ReferenceError: module is not defined
See original GitHub issueWhen 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:
- Created 6 years ago
- Reactions:1
- Comments:9 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m going to drop the
core-jsimport. Make sure that you provide your ownObject.assignpolyfill if you’re usingobjectAssignand have to support IE11It does exist, you have to
npm install core-js. If you’re not usingnpmwe don’t have a solution at the moment, I’m afraid.