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

Object spread operator is breaking in local dev #13

Closed
dangdennis opened this issue Sep 6, 2018 · 10 comments
Closed

Object spread operator is breaking in local dev #13

dangdennis opened this issue Sep 6, 2018 · 10 comments

Comments

@dangdennis
Copy link
Contributor

dangdennis commented Sep 6, 2018

❔ Issue

Ky is breaking due to the use of Object Spread Operator.

🔦 Context

I've tested it with Create-React-App. CRA supports the Object Spread Operator, however if it's used within a module, Babel does not transpile it. Interestingly enough, Ky works fine when I add into a box at Codesandbox.io.

💻 Error Sample

./node_modules/ky/index.js
Module parse failed: Unexpected token (21:19)
You may need an appropriate loader to handle this file type.
| 				}
| 
| 				returnValue = {...returnValue, [key]: value};
| 			}
| 		}

🌍 Your Environment

Create react app @ latest
Node @ v10.6.0

@szmarczak
Copy link
Collaborator

because the library isn't being ran into webpack/parcel.

It doesn't have to. Are you sure you're on Node 10?

@dangdennis dangdennis changed the title How do you develop ky locally? Object spread operator is breaking in local dev Sep 6, 2018
@dangdennis
Copy link
Contributor Author

I'd expect it to work as well. I just installed the latest Node to upgrade from 10.6 -> 10.9. Oh well, I'll chalk it up to my environment. And see what I can do.

@dangdennis
Copy link
Contributor Author

If you or anyone would like to try the test app locally, here's what I was testing with.
https://github.com/dangdennis/ky-cra-test

@sindresorhus
Copy link
Owner

sindresorhus commented Sep 6, 2018

@watch2raff
Copy link

I have this problem to. My version node - v8.9.3
If i want use ky, i must install version 10 ?

@dangdennis
Copy link
Contributor Author

Hey @watch2raff ,

How are you using the package? Mine was breaking due to some problems with Babel 7 and npm symlinking.

@jsardev
Copy link

jsardev commented Sep 12, 2018

Having the same error while using it with next.js. Node 10.9.0.

Edit: @sindresorhus @szmarczak create-react-app has the object-rest-spread babel plugin builtin so it's not about it. This library just won't work for some reason with it 😛

@ghost
Copy link

ghost commented Sep 12, 2018

Same problem.

@jsardev
Copy link

jsardev commented Sep 12, 2018

The reason is that ky does not provide a precompiled ES5 module. Created a separate issue for that: #28

@watch2raff
Copy link

watch2raff commented Sep 13, 2018

Hey @watch2raff ,

How are you using the package? Mine was breaking due to some problems with Babel 7 and npm symlinking.

I using this package in my app create with create-react-app.

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

5 participants