Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error importing react-modal #418

Closed
mrscobbler opened this issue Jun 16, 2017 · 10 comments
Closed

Error importing react-modal #418

mrscobbler opened this issue Jun 16, 2017 · 10 comments
Labels

Comments

@mrscobbler
Copy link

Summary:

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({

Steps to reproduce:

  1. yarn add react-modal
  2. Add this statement at the top of my code: import Modal from 'react-modal'

Expected behavior:

Modal should not cause an error when importing

Additional notes:

I tried deleting my node_modules folder and running yarn but that didn't seem to fix the issue

@ingro
Copy link
Contributor

ingro commented Jun 16, 2017

Yeah it seems like the code is not compiled correctly.

@dmbaranov
Copy link

Same for me.

@diasbruno
Copy link
Collaborator

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.

@danhayden
Copy link
Contributor

danhayden commented Jun 16, 2017

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.

@diasbruno
Copy link
Collaborator

diasbruno commented Jun 16, 2017

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!

@stephane-r
Copy link

Same issue, but work with v1.9.7 in Meteor project.

@diasbruno diasbruno modified the milestone: 2.1.0 Jun 16, 2017
@diasbruno diasbruno added the bug label Jun 16, 2017
@diasbruno
Copy link
Collaborator

Released v2.0.1.

@stephane-r
Copy link

Fix for me. Thank you @diasbruno !

@diasbruno
Copy link
Collaborator

@Leg3ndz Thank you. Also, a fix to removed all prop-types warnings was released in v2.0.2.

@stephane-r
Copy link

@diasbruno Yep, prop-types warning are removed in v2.0.2.

Thank you ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants