I tried to add react-modal to my project and I'm getting this error:
Module parse failed: /node_modules/react-modal/lib/components/Modal.js Unexpected token (36:19)
You may need an appropriate loader to handle this file type.
|
| /* eslint-disable react/no-unused-prop-types */
| static propTypes = {
| isOpen: PropTypes.bool.isRequired,
| style: PropTypes.shape({
yarn add react-modalimport Modal from 'react-modal'Modal should not cause an error when importing
I tried deleting my node_modules folder and running yarn but that didn't seem to fix the issue
```
Yeah it seems like the code is not compiled correctly.
Same for me.
hmm, I thought babel-preset-stage-2 was enough for this.
A PR to fix this would change from stage-2 to latest.
I'll be back in a few minutes.
Is this not because main in package.json is "./lib/index.js" and should be "./dist/react-modal.min.js"?
As importing the module is currently returning the source code and not the transpiled code.
Sorry for the inconvenience. I just had to push forward to get v2.0.0 and fix our repository, but I probably forgot to push an important commit from the old master (now branch v2).
@danhayden you are right.
See PR #417, @ajfuller is already working on this.
Please, use v1.9.7 until we fix this issue.
Thank you all!
Same issue, but work with v1.9.7 in Meteor project.
Released v2.0.1.
Fix for me. Thank you @diasbruno !
@LeG3nDz Thank you. Also, a fix to removed all prop-types warnings was released in v2.0.2.
@diasbruno Yep, prop-types warning are removed in v2.0.2.
Thank you ;)
Most helpful comment
Is this not because
mainin package.json is"./lib/index.js"and should be"./dist/react-modal.min.js"?As importing the module is currently returning the source code and not the transpiled code.