Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

module.exports now throwing "Unexpected indentifier" error at runtime #37

Closed
mgreer opened this issue Dec 12, 2015 · 6 comments
Closed

Comments

@mgreer
Copy link

mgreer commented Dec 12, 2015

This happens on on dev environment, and only at runtime. And only for ES6 classes (not React.createClass components) being used in redux-forms.

class GiftCodeForm extends React.Component {
...
}
...
module.exports = connectReduxForm({
    form: 'gift_code_form', 
    fields: ['code'],
    validate: validateForm
})(GiftCodeForm);
module.exports = GiftCodeForm;

I'm using babel6 and the new babel-react-transform. If I remove react-transform-hmr from .babelrc, error goes away.

Here's the .bablerc:

{
  "presets": ["es2015", "react", "stage-0"],
  "env": {
    "development": {
      "plugins": [
        ["react-transform", {
          "transforms": [{
            "transform": "react-transform-hmr",
            "imports": ["react"],
            "locals": ["module"]
          }, {
            "transform": "react-transform-catch-errors",
            "imports": ["react", "redbox-react"]
          }]
        }]
      ]
    }
  }
}
@jamiebuilds
Copy link
Collaborator

Please include the generated code when submitting bugs like this.

@pbojinov
Copy link

Here's the stack trace from console

image

And the generated code https://gist.github.com/pbojinov/645aabe47a0b091b17a3

@jamiebuilds
Copy link
Collaborator

That stack trace doesn't make any sense, there's nothing even related to this.

I'm going to close this, you can either look for support in https://slack.babeljs.io, http://discuss.babeljs.io or http://www.reactiflux.com.

If you want, you can also create a repo with a minimal reproduction case that demonstrates this problem.

@mgreer
Copy link
Author

mgreer commented Dec 15, 2015

We'll try and make an isolated test case, of course! The error is very inconsistent, so an isolation would make it clear for sure. We just thought perhaps you'd have a notion off the top of your head.

The reason we are bringing it up here is that the error appears only in development, and only when we changed to using react-transform-hmr with no other code change. In fact, if we turn off hmr, it works fine.

Test case forthcoming...

@erosenberg
Copy link

Any updates on this? I'm getting the same errors.

@gaearon
Copy link
Owner

gaearon commented Mar 6, 2016

There can’t be any updates without a reproducible case. It’s literally impossible to come up with updates from thin air 😉 . If you contribute a repro case, I’m happy to take a look, but for now I am closing. Cheers!

@gaearon gaearon closed this as completed Mar 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants