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.

ReferenceError: require is not defined in ES module scope, you can use import instead

See original GitHub issue

Describe the bug ReferenceError: require is not defined in ES module scope, you can use import instead

To Reproduce "plyr-react": "^5.0.2",

Expected behavior For some reason, the library breaks the compiler when used inside a Node Module.

Screenshots image

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
chintan9commented, Jul 21, 2022

I created this PR. #892 This fixes the issue. Don’t know why they are not merging.

Please add this line at 2 https://github.com/chintan9/plyr-react/blob/master/src/index.tsx

import PropTypes from 'prop-types'

plyr-react@5.1.0 was published.

Please check now

1reaction
sakib412commented, Jul 21, 2022

I created this PR. https://github.com/chintan9/plyr-react/pull/892 This fixes the issue. Don’t know why they are not merging.

Read more comments on GitHub >

github_iconTop Results From Across the Web

require is not defined in ES module scope, you can use import ...
ReferenceError: require is not defined in ES module scope, you can use import instead gulp sass ; require('gulp-sass')( ; module babel-register ...
Read more >
How to fix the error `require is not defined` in Node.js
Solution · change the type of modules in package.json to commonjs : "type": "commonjs" · delete the string "type": "module" from the file...
Read more >
How To Fix ReferenceError require is not defined in JavaScript
In this case, check your package.json file for an property called type . If that is set to module , ES6 modules will...
Read more >
ReferenceError: require is not defined in JavaScript | bobbyhadz
To solve the "ReferenceError require is not defined" error, use the ES6 module import and export syntax. The require() function is Node.js specific...
Read more >
How to fix "require is not defined" in JavaScript / Node.js?
If you are getting the “ReferenceError: require is not defined” or “require-is-not-defined” error in Node.js, you probably either have set the ...
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