question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

https://github.com/benjamine/jsondiffpatch/issues/249

https://github.com/n1ru4l/graphql-live-query/blob/868404fd564d0a2b32fc4a3533edffc1ba932101/packages/graphql-live-query-patch-json-diff/src/applyJSONDiffPatch.ts#L2

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
n1ru4lcommented, Aug 10, 2021

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

1reaction
TrentWest7190commented, Aug 10, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update chalk dependency · Issue #13728 · babel/babel - GitHub
What problem are you trying to solve? I've just been running Babel core in Deno using JSPM import maps ... Update chalk dependency...
Read more >
chalk package issue in nodejs - Stack Overflow
The error above is because you're using the Common.JS module require syntax rather than the ES module import syntax. Update: const chalk ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found