-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Support ES.Next object rest spread in config files like rollup.config.js #1759
Conversation
This doesn't fix #1757. This PR only applies to es.next syntax in the config. |
Thanks @nathancahill, I have taken the liberty to change that in the description 😉. If we include this, we should probably keep the bublé transformations even once object rest spread has reached stage 4 and is officially supported by acorn to not introduce a breaking change for users who opted to use even more unsupported features (whatever those are). Just something to consider. |
Since there were no other opinions voiced, I'll put this into the next patch release. |
It is true this might be bad, since bublé transpilation lacks many ECMAScript ES.Next features, in particular async breaks havoc. Instead once can transpile rollup.config.js ahead of time: rollup.config.js can be transpiled using es2049scripts from the ECMAScript 2049 package An example of this is here rollup.config.mjs: Another interesting project is zero-configuration RollupJS provided by es2049package: Here is an example of transpiling with RollupJS configuration-free using es2049package: Documentation on how to use RollupJS without rollup.config.js I wanted to tell @Rich-Harris and @lukastaegert about this.
|
I guess we should remove bublé again at some point. Once #1857 is released (which I plan for the next non-patch release), we could just use this to add object rest spread manually. |
And object spread properties is in Node.js natively since v8.6, so the reason this was put in is no longer valid. |
@haraldrudell Not everyone is already using Node >= 8.6. |
Sidenote: why does rollup take on the responsibility of transpiling the config file? This seems like overkill. If I'm running a version of node that doesn't support a certain ES feature, I don't really have an expectation of those features working. If I do want new ES features to work, I can use |
Actually I agree. Object rest spread was the single one thing people kept wishing for config files + there was this PR and I did not expect bublé to cause so much trouble. Now Object rest spread can be easily approximated with |
fixes #1758
test preparation:
test execution:
./bin/rollup --config ./test.js