souporserious / react-measure

📏 Compute measurements of a React component.
https://souporserious.github.io/react-measure/
MIT License
1.94k stars 109 forks source link

@babel/runtime is not a dev dependency #123

Closed julioolvr closed 5 years ago

julioolvr commented 5 years ago

In a project with Babel 6 and Webpack 3, trying to use react-measure throws several errors like:

ERROR in ./node_modules/react-measure/dist/index.esm.js
Module not found: Error: Can't resolve '@babel/runtime/helpers/esm/extends' in '/Users/joliv/Dev/website/node_modules/react-measure/dist'

dist/index.esm.js does try to import stuff from @babel/runtime but that seems to be a transitive dev dependency of the project, so I'd expect it not to be referenced by build artifacts. That being said I could be wrong - I'm not sure what are common expectations, but it feels that if Babel 7 were required to use the project then @babel shouldn't be a dev dependency.

For the time being, I'm still testing this out but npm add @babel/runtime seems to be working and is playing well with having Babel 6 in the same project so far.

souporserious commented 5 years ago

Oops! Sorry about that 😅. It should be fixed under v2.2.2. Please feel free to reopen if there are any further issues. Thanks for filing an issue! 🙏

ahmedsharif commented 5 years ago

I am facing the same issue that @julioolvr posted last time. I follow your solution and down-grade react-measure version to 2.2.1 but it still give me same error.
babel_error

souporserious commented 5 years ago

Hmm weird 🤔 this should be fixed in the latest version. @ahmedsharif does this error occur with v2.2.2 installed?

ahmedsharif commented 5 years ago

Yes. I tried these versions v2.2.2 v2.2.1 and v2.2.3. Can you kindly help me regarding this issue?

souporserious commented 5 years ago

@ahmedsharif I just got back from vacation so I have some things to catch up on, but I will look into this as soon as I get a chance. Please feel free to submit a PR if you come across a solution. I might try updating @babel/runtime to see if that helps anything.