Closed jfrancos closed 3 years ago
Maintainer of Snowpack here! Snowpack uses Rollup to install your dependencies, so I just wanted to highlight that this is most likely affecting all other Rollup projects as well.
Hi @FredKSchott,
What are your thoughts on next steps for getting offix to work with snowpack? I think your comment implies that rollup is the place where this needs to get fixed, rather than here (but I'm not 100% -- sorry if I'm being dense here)
If you think I ought to just repost this as a rollup issue (I am happy to do this), can you point me in the direction of your rollup.config.js
file, and let me know any other helpful info I could include in the issue?
I would look to see if we can do something about it. We use browserify and webpack. There is issue we have to start publishing our packages in minified precompiled version ( we do not do that now)
Thanks @wtrocki. So I think you're saying this is an issue that would need to be addressed in offix, not snowpack or rollup. Or am I oversimplifying it? I do see (I think?) an analogous suggestion in the apollo issue mentioned in my initial post.
@FredKSchott, is there something I can do in Snowpack analogous to this workaround, from the same apollo issue?
@lukastaegert (rollup maintainer) -- do you have any thoughts on this, or suggestions for a work-around?
Offix exports modules using common.js format. https://github.com/aerogear/offix/blob/master/tsconfig.json#L16
Those cannot be used in the web directly and require users to use bundler. This is due to number of factors:
@jfrancos Offix itself wasn't updated to latest Apollo version. If you require only read only access check apollo cache persist (which have been tested with Apollo 3.0 and has active rollup config)
I'm mantainer of both projects. In offix we currently building an datastore solution. For Apollo 3.0 offline support I would recommend to use https://github.com/apollographql/apollo-cache-persist that exports package in bundled and minified form.
As for issue this is due to using '@apollo/client' (3.0)
with the packages that are coming from apollo 2.0
Hi @jfrancos, we have made the decision to move away from the Apollo client and we have decided to deprecate our Offix packages and release our Datastore. I will be closing this issue, but if you have any questions, please feel free to let us know.
You can see the docs for the updated datastore here: https://offix.dev/docs/getting-started
Bug Report
Trying to use offix-client with snowpack 2.18.5, but calling
new ApolloOfflineClient(config)
results in gettingUncaught TypeError: _super.call is not a function
For a sanity check I tested it out with CRA, and this issue does not come up. On the other hand, I was previously using snowpack with @apollo/client, and likewise, this issue did not come up.
Googling the above error, the main thing I found was this apollo-client issue from 2017, where it seemed the problem had to do with rollup. I believe snowpack does use rollup.
Here's some minimal code to reproduce the issue:
It seems the error is due to some kind of module style incompatibility, and I was able to get the
_super.call
error to go away by adding the following two lines to offix/packages/offix/client/tsconfig.json:But now, there is a jest test failing with
I can try to figure out how to get the tests to pass, but first I thought I'd pause and get some feedback: