-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Upgrade to Babel v6 #488
Comments
Word of advice, apparently you have to put some plugins inside your presets array, like so: {
"presets": [
{
"plugins": [
"syntax-class-properties",
"transform-class-properties"
]
},
"es2015",
"react",
"stage-0"
]
} |
From discussion of this Babel 6 official post
Hope that helps |
@erikras we'll have to wait for some dependency updates to support babel 6 (react-transform, typecheck and eslint)... in the meantime, our new {
"presets": ["es2015", "react", "stage-0"],
"plugins": [
"typecheck"
],
"env": {
"development": {
"plugins": [
["react-transform", {
"transforms": [{
"transform": "react-transform-hmr",
"imports": ["react"],
"locals": ["module"]
}, {
"transform": "react-transform-catch-errors",
"imports": ["react", "redbox-react"]
}]
}]
]
}
}
} a couple of notes :
i'm happy to take care of this once deps are supported |
Awesome work, @justingreenberg!! 👍 If anyone comes across this issue after the next |
Babel Doctor was just released. Might be helpful to this issue. |
I did this yesterday on another project of mine. It took a couple hours. Babel no longer takes options. You need to specify everything in .babelrc: You have to require polyfill if you are using regenerator (async/await)
|
When we do upgrade to Babel 6, let's try and lump it into one nice commit so everyone can migrate easily! |
Babel 6 Migration (Updated 12/09/15):
so yeah, bleeding edge is all fun and games until your toolkit completely changes |
"Bleeding edge is all fun and games". LOL. 🔪 🏥 💉 |
to be honest I would mark this repository as stable before going to babel 6. |
I was thinking the same thing. However, with thoughts to "stable", React itself is still not 1.0, but Redux and React-Router are. Should we continue as pre-1.0 or not? |
@erikras ^ |
You could probably edit the comment and still manage to tag me. In fact, I'm gonna try that with this comment. [Edit: @quicksnap] 😃 It's a shame that even Facebook fails to follow SemVer. I'm confused as to what this "stable" labeling actually means. Do you just mean declaring |
Just a couple more days.. |
Seems gaearon/babel-plugin-react-transform#50 has been merged. Any updates on this front? |
@erikras are you ok with removing decorators? |
currently no, follow Line 83: "Decorators are not supported yet in 6.x pending proposal update." however, it looks like things have changed since my last update:
TL;DR; support is coming, at some point, and they were thinking about it as recently as a week ago which is encouraging. however, if you take the time to read the thread above, there are going to be a few gotchas, and having been involved in the initial effort to convert the initial react-transform plugin, i can say from experience—transpilation is dirty work... @erikras up to you dude |
How about using the following plugin until babel implements the new decorator proposal: Mentioned here:
|
My vote would be to wait until the dust on decorators settles. |
@quicksnap agreed—or replace with higher order functions until there's supported in at the end of the day it's just a fantasy until the proposal gets through TC39. i'm still traumatized from losing my beloved i'm all for using experimental features, but we should still make an effort to keep ES as idiomatic as possible—let's not delude ourselves. using babel to transform code to a target that doesn't really exist just feels like the wrong way to be using it. |
@lndb that is a very experimental implementation—if you read the full thread there are a bunch of issues, including conflicts with class property transforms. it looks like a massive headache to support what is essentially just syntactic sugar. if decorator support is critical, we should just hold off on babel 6 for now |
@quicksnap , @erikras Any updates on this?.. |
@sars for update see: https://phabricator.babeljs.io/T2645 the legacy plugin mentioned by @lndb babel-plugin-transform-decorators-legacy was updated yesterday by a core contributor and should provide the same functionality with babel 6, most of the issues appear to have been resolved. i have not tested it yet, but if it works i could probably take care of migration over the weekend |
@justingreenberg Did you get a chance to play with the legacy update? Were things smooth? Any hope for 6.0 within the next week or so? I was about to blindly dive into upgrading to 6.0 just now - this thread saved me ❤️. |
@justingreenberg Why do we need such decorators at all? where do we use them? May be it make sense to avoid using them so far, if there are not lots of places in the code, where we use them? |
@sars i agree and prefer composability personally, but decorators are used extensively in this project and many developers seem reluctant to give them up... we are even chaining them ie: /// containers/app.js
@connectData(fetchData)
@connect(state => ({user: state.auth.user}), {logout, pushState})) @isTravis i'm sorry i have been so swamped with real life that i may not get around to this for another week or two. i totally know how important it is to get this updated to babel 6—i haven't forgotten about it! i will attempt migration with legacy decorators so existing code can be left as-is. some of the more advanced usage may break the transform, in which case i'll refactor the edge cases to use functional composition for now, if @erikras @quicksnap are cool with that. due to the advanced syntax and deep babel integration in this project, a sloppy migration will result in mysterious bugs that are virtually impossible to identify without a deep understanding of the toolchain and build pipeline. i need to spend an afternoon to bring myself up to speed on the codebase and carefully implement the update. |
@justingreenberg No problem! I'm actually all set with the upgrade. I followed #778 and things were smooth for me! I don't use decorators much in my code - so that wasn't an issue for me. Thank you for following up! |
no worries—i hadn't even seen that pr, obviously i need to get back up to speed. #778 looks good at a glance, i'm glad it worked for you! without decorators the update is pretty straightforward 👍 |
Anyone want to give this a shot? Quite a few things have changed. I don't really understand how the react-transform stuff is set up in the
.babelrc
. I got most of the way there, but had to turn back.Kudos for anyone who can figure this out.
The text was updated successfully, but these errors were encountered: