palerdot/react-d3-speedometer

[deprecated][v0.5.6] Missing lodash error/bug fixed in 0.5.7+version

Closed this issue · 1 comments

Here is a working fixed version sandbox link - https://codesandbox.io/embed/confident-swanson-hvl34

Issue Analysis:

import { isNumber as _isNumber } from "lodash"

Above piece of code was added, without adding lodash as a dependency. Scary thing was, lodash was a dependency for other libraries like storybook, babel etc ... so lodash was implicity available in my existing node_modules ...

The transpiled code was just require('lodash') from the main node_modules ... since, lodash was not listed as a dependency, when using this in a project that does not use lodash ... the code require('lodash') would fail since it would not have been installed ...

Even now, react is not listed as a dependency, but it is ok, since it is a react library, the assumption is people would be using it with their existing setup.

Tests were passing because lodash was some dependency of some devDependency, so lodash was implicitly available in the test environment ...

This is kind of scary and should find a way to sandbox the build and verify it ...