mojotech / json-type-validation

TypeScript JSON type validation
MIT License
155 stars 14 forks source link

Slim down lodash dependencies #59

Closed geigerzaehler closed 3 years ago

geigerzaehler commented 3 years ago

We replace the lodash.isequal dependency with lodash/isEqual. This makes it more likely that bundlers can deduplicate this dependency if other dependencies use lodash too.

To fully leverage this we also want to properly expose this in the bundles. First, we use the ES Modules import so that the module bundle uses it too instead of inlining require('lodash/isEqual'). To prevent bundling this dependency we modify the external rollup configuration.

We also replace the UMD bundle with a CommonJS bundle. Before, rollup would just inline require('lodash/isEqual') so the bundle would not function as a UMD bundle anyways.