bpmn-io / bpmn-js-differ

A diffing utility for BPMN 2.0 documents.
MIT License
45 stars 17 forks source link

Update jsondiffpatch-Library #5

Closed MaxStroh closed 6 years ago

MaxStroh commented 6 years ago

Hi guys,

we are using the bpmn-js-differ lib and experience warnings since we refactored our project to use webpack. Webpack warns us, that the library jsondiffpatch has got a critical dependency in its code because the request of an internal dependency is an expression:

WARNING in ./node_modules/jsondiffpatch/src/main.js 56:20-50 Critical dependency: the request of a dependency is an expression @ ./node_modules/jsondiffpatch/src/main.js @ ./node_modules/bpmn-js-differ/lib/differ.js @ ./node_modules/bpmn-js-differ/index.js

WARNING in ./node_modules/jsondiffpatch/src/main.js 61:19-47 Critical dependency: the request of a dependency is an expression @ ./node_modules/jsondiffpatch/src/main.js @ ./node_modules/bpmn-js-differ/lib/differ.js @ ./node_modules/bpmn-js-differ/index.js

The parts in the code of jsondiffpatch are the following (jsondiffpatch/src/main.js): ... if (environment.isBrowser) { exports.homepage = '{{package-homepage}}'; exports.version = '{{package-version}}'; } else { var packageInfoModuleName = '../package.json'; var packageInfo = require(packageInfoModuleName); exports.homepage = packageInfo.homepage; exports.version = packageInfo.version;

var formatterModuleName = './formatters'; var formatters = require(formatterModuleName); exports.formatters = formatters; // shortcut for console exports.console = formatters.console; } ...

So i checked which version of jsondiffpatch you are using in the bpmn-js-differ lib (>> version 0.2.5). In the newest version of jsondiffpatch (0.3.9), this part of code is refactored.

We would be very thankful, if you could update the bpmn-js-differ dependencies to jsondiffpatch version 0.3.9!

nikku commented 6 years ago

Happy to update if you provide a PR that passes our test suite.

nikku commented 6 years ago

Just to point you to a small, unfortunate side-effect of your changes: The version bump increased the library bundle size by 80%. :cry:

nikku commented 6 years ago

I'll have a look how we can optimize this in the future.