turf/dissolve dependency assert problem

Created on 7 Mar 2017  路  6Comments  路  Source: Turfjs/turf

In https://github.com/Turfjs/turf/blob/master/packages/turf-dissolve/package.json#L42

"get-closest": "0.0.3" is being required, but "get-closest" has an issue.

In their code, in their index.js, they require a library that is not included in their dependencies.
https://github.com/cosmosio/get-closest/blob/master/index.js#L10

This causes an error that can prevent a project from running since node will complain about a missing module "assert"

I wanted to raise awareness that using "get_closest" in turf was preventing my project, that uses turf, from building until I had manually installed this "assert" library.

Here is a link to the issue I created in their github page: https://github.com/cosmosio/get-closest/issues/3

bug

All 6 comments

Thanks for the report @suark - we'll take a look and see if we can remove that dependency if it's going to be problematic.

That's pretty annoying... the module assert is a native NodeJS module, however it breaks in the browser since the browsers don't have that module.

I'm sure we can remove get-closest as a dependency, it's only a few lines of code and fairly easy to re-implement.

Browserify automatically stubs assert with browser-assert because its goal is node/browser intercompatibility - other bundlers (webpack, rollup) do not because their goal is bundling only. If we were maintaining that module, we could use invariant as a cross-compatible replacement, or maybe even now we can change the rollup config to require browser-assert.

Get closest has been updated and the new 0.0.4 doesn't use "assert"

@suark Thanks! 馃憤

However get-closest 0.0.4 doesn't exist on NPM yet.

Send a PR with the changes to the package.json when it becomes available.

Updated get-closest dependency https://github.com/Turfjs/turf/commit/ec5ef9d4bbe8f4a104abc88d159eb023f51c5095 (will be fixed next TurfJS release).

Was this page helpful?
0 / 5 - 0 ratings