Skip to content
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

How can I stop from transform rest-spread operators #636

Closed
shuaiyaotian opened this issue Jul 4, 2018 · 4 comments
Closed

How can I stop from transform rest-spread operators #636

shuaiyaotian opened this issue Jul 4, 2018 · 4 comments

Comments

@shuaiyaotian
Copy link

Chrome supports the feature object-rest-spread, I don't want to transform it in babel.
But I got Syntax Error always, and the tips: "Add @babel/plugin-proposal-object-rest-spread (https://git.io/vb4Ss) to the 'plugins' section of your Babel config to enable transformation."

How to get around.

Webpack Version:
2.x

Babel Core Version:
7.x

Babel Loader Version:
8.x

@existentialism
Copy link
Member

@shuaiyaotian even if you dont want to transform rest-spread, you need to add @babel/plugin-syntax-object-rest-spread to your plugins inside your Babel config so that our parser can parse it. As a side note, @babel/preset-env takes care of this by default :)

@shuaiyaotian
Copy link
Author

@existentialism Thank you.
After reading the source code, I realized that rest-spread must be transformed. I can't run code without parsing it in browser, if I use babel.
disappointed~

@alex996
Copy link

alex996 commented Sep 3, 2018

@existentialism I don't understand... Object Rest/Spread Properties is already a Stage 4 (Finished) proposal and is part of ES2018 spec. The same exact code runs fine in Chrome 68, but fails with babel-loader. Why is Babel still throwing Support for the experimental syntax 'objectRestSpread' isn't currently enabled? Is there plans to whitelist it anytime soon? Why or not? Otherwise, is there a way to enable it manually? Thanks

@nicolo-ribaudo
Copy link
Member

It will be enabled by default by babel/babel#8448. In the meantime, you can use @babel/plugin-syntax-object-rest-spread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants