Closed popojargo closed 6 years ago
@popojargo there is a "slim" version in /dist/jsondiffpatch.umd.slim.js
that is built without diffmatchpatch (ie. no long text diffing) and without chalk.
you can find it at https://cdn.jsdelivr.net/npm/jsondiffpatch/dist/jsondiffpatch.umd.slim.js
(the effect is that when chalk is not available no colors are used)
I'm not sure if you tried using this one, can you share the build errors you mention?
ps: I noticed 0.3.8 was depending on Symbol
(ES6) and fixed that on 0.3.9, so you might want to update in case this is related.
Error when running npm run build
with React 16.0 and jsondiffpatch 0.3.9
> react-scripts build
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/jsondiffpatch/node_modules/chalk/index.js:55
Read more here: http://bit.ly/2tRViJ9
Tl;DR
The chalk dependency is not ES5 compliant. React by default refuse to compile module not ES5 compliant.
Current workaround: use a version without dist package (eg: ^0.1.41)
I have the same error with the slim build. I opened the file and it seems to import chalk. Can you verify that @benjamine ?
Hi,
I am getting this too.
Failed to minify the code from this file:
./node_modules/jsondiffpatch/node_modules/chalk/index.js:55
What is the fix until the new version is released? When do you plan to release the new version to NPM?
Thank you for your work on jsondiffpatch. It is a great lib.
fixed at https://github.com/benjamine/jsondiffpatch/commit/c7ab56562f63be13a8ba4c6f767808b9aeaf0956 published as v0.3.10, thanks everyone for the detailed report, diagnosing and helping come up with a solution 👍
The current version is delivered with a console formatters which use Chalk (Not ES5 compliant).
I'm using this in React and it prevents me from building since it's not supported by all browsers.
Any plans to deliver a build without the console formatter?
Suggestions
Maybe it would require the CLI to be in a separate repository
Easiest solution but if they start using NodeJS stuff that can't be transpiled, it won't run on a browser.