-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Node.js version specific Babel presets #148
Comments
Looks like work has already begun: https://www.npmjs.com/package/babel-preset-es2015-node5 Still, I think it might be better to automate this. I am thinking of create a test-file for each of the available plugins that uses the specific feature that plugin provides. Then a script to require each in a try/catch and see if they throw / fail to compile. That gives us a nice automated update path as future versions are released. I am hoping babel's own test suite will make this all a simple matter of cutting and pasting code samples... There are a lot of plugins. |
Wouldn't live feature testing be slow? I had a similar idea of doing the feature testing for every major Node.js version before publishing. |
Yes - as part of the update process. Not live testing. After the test suite runs we output a file for that specific version in a subfolder: // index.js
module.exports = require('./plugin-lists/' + process.version); // probably not necessary to the patch level, but you get the idea or something like that. |
👍 That's exactly what I was thinking. |
It might be cool to fetch the actual plugins from Definitely not something to target for the first release, but might be interesting to play with down the road. |
Haven't implemented it yet but I would like to see at least a preset where you can specify that environment you want to target and it would have a predetermined list of transforms based on what it supports. You could just use the data or use |
@novemberborn I'm a little bit sceptical of feature testing. New features might be buggy or slow. I would be more comfortable with a preset that choose plugins based on vetted testing on various Node.js versions. Maybe babel-preset-env when it gets more mature. |
Is fixed by #1193. |
So Babel only transpiles features not already supported by the platform.
@jamestalmage said he's interested in looking into this.
The text was updated successfully, but these errors were encountered: