n1ru4l/graphql-live-query

Issue with chalk dependency within jsondiffpatch [graphql-live-query-patch-jsondiffpatch]

TrentWest7190 opened this issue · 6 comments

benjamine/jsondiffpatch#249

The issue is that the @n1ru4l/graphql-live-query-patch-jsondiffpatch package doesn't function in-browser due to importing everything from the jsondiffpatch package within this file, which makes the browser try to import the chalk dependency, which throws an error in the browser because it's trying to access process which doesn't exist outside of node.

It looks like the intended solution, from the jsondiffpatch readme is to import one of the distributions within the package for browser use:

https://github.com/benjamine/jsondiffpatch#browser

browser

In a browser, you could load directly a bundle in /dist, eg. /dist/jsondiffpatch.umd.js.

Ah it is unfortunate that this package is pretty messy 😰 Maybe we should inline it here instead - and further tweak it to not include the previous result - only the addition

Ah it is unfortunate that this package is pretty messy 😰 Maybe we should inline it here instead - and further tweak it to not include the previous result - only the addition

100% I was thinking the same thing

@dburles @TrentWest7190 Contributions would be highly appreciated :)

I finally created a slim version 🥳 #692

Closing this as the jsondiffpatch dependency got removed 🥳