Swydo / ddp-apollo

DDP link for Apollo with GraphQL Subscriptions support
MIT License
176 stars 17 forks source link

NPM package apollo-link-ddp displays a warning for missing meteor/meteor package #314

Open alxmhe opened 5 years ago

alxmhe commented 5 years ago

When building a front-end app (eg. Create React App) with apollo-link-ddp, the compiler cannot find the package meteor/meteor and throws a warning.

https://github.com/Swydo/ddp-apollo/blob/206248064d19072e83e61844944d972442b4efb3/packages/apollo-link-ddp/src/client/apollo-link-ddp.js#L18

jamiter commented 5 years ago

Hm, it's in a try/catch for that reason. You might be able to tell your compiler to ignore it. Any suggestions on how to fix this otherwise? The idea is that the Meteor connection is the default. I could also try to check the Meteor global object but kinda liked the "official" import statement.

alxmhe commented 5 years ago

I found this https://github.com/maxnowack/meteor-globals/blob/master/src/checkMeteor.js Not sure if it's the way to go.

alxmhe commented 5 years ago

Could it be done with dynamic imports? https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports