wellth-app / apollo-offline

Apollo 2.0 Implementation allowing for offline mutations.
3 stars 0 forks source link

Use Babel #1

Closed RishitKedia closed 5 years ago

RishitKedia commented 6 years ago

Hey, Justin! 👋

This is super interesting, and I'd like to try this for my app.

I'm not using Flow, and when I import apollo-offline in my Webpack project, I get the following error:

ERROR in ./node_modules/@wellth/apollo-offline/src/index.js
Module parse failed: Unexpected token (19:7)
You may need an appropriate loader to handle this file type.

I guess you have to strip the Flow types while compiling for non-Flow users.

Thanks! 🙃

Edit

As it turns out, it wasn't just Flow that was causing issues. apollo-offline is also not being transpiled to ES5 by using something like Babel. I've managed to get rid of the errors with Babel on my end, but you may already know that it's common practice to use Babel to transpile to ES5, and also strip the Flow types, so that anyone and everyone can use apollo-offline. So, it'll be nice if Babel is used here. 🙏

For more information, for example, see https://javascriptplayground.com/npm-flowjs-javascript/.

justinmakaila commented 5 years ago

Hey @RishitKedia, would happily accept a PR for babel support... I also realize this is over a year late. The library has recently been refactored to utilize typescript for compilation, not sure if that has an effect.

RishitKedia commented 5 years ago

Better late than never! 😄 I'm not working on that project of mine anymore, though. It's been over a year! 😋

I think TypeScript should have it covered now. So, I'm closing this.

Also, feel free to close #2 depending on whether you want to implement it or not. 🙂