-
Notifications
You must be signed in to change notification settings - Fork 760
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
CoffeeScript React component generator is fixed #768
Conversation
…ut the modules and require React objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry this one has taken so long to get to. Can you merge master in so I can see if tests now pass on this and we will look at getting this merged? I'm not seeing any failing tests on master for the moment so we may look to getting a test added that exercises the failing behaviour this fixes.
if options[:coffee] | ||
%|React = require('react')\n| | ||
else | ||
%|var React = require("react")\n| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would these work as import rather than requires if it's webpack?
if options[:coffee] | ||
%|module.exports = @#{component_name}| | ||
else | ||
%|module.exports = #{component_name}| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to above, could these be export default rather than module.exports?
Yeah, I've corrected the code you mentioned, it is right to stick to one of the possible syntaxes. Also, PropTypes was removed from base 'react' source code, so now it must be imported in such way: |
I've merged your code and commits into #798 and corrected the associated tests. Thank you for your help with Coffeescript! Could you test out that branch and see if it meets your needs? |
CoffeeScript React component generator is fixed to modules export of component and to require the React object.
rails g react:component Sample --coffee
Before:
After: