We're updating the issue view to help you get more done. 

Node packages using require('assert') fail compilation

Description

When including packages that contain "require('assert')" as a node dependency – for example, https://github.com/uber/react-map-gl – Clojurescript fails to compile the module with the following error (note that importing react-map-gl currently requires closure compiler master because Mapbox GL has dependencies which require the fix from https://github.com/google/closure-compiler/pull/2579):

1 2 3 4 5 6 WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "assert" at [...]/node_modules/react-map-gl/dist/utils/map-state.js line 14 : 4 WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "assert" at [...]/node_modules/react-map-gl/dist/utils/map-state.js line 14 : 14 WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "assert" at [...]/node_modules/viewport-mercator-project/dist/perspective-mercator-viewport.js line 24 : 14 WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "assert" at [...]/node_modules/viewport-mercator-project/dist/perspective-mercator-viewport.js line 24 : 4 WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "assert" at [...]/node_modules/viewport-mercator-project/dist/viewport.js line 52 : 14 WARNING: JSC_JS_MODULE_LOAD_WARNING. Failed to load module "assert" at [...]/node_modules/viewport-mercator-project/dist/viewport.js line 52 : 4

For reference, the relevant js files:
https://unpkg.com/react-map-gl@3.0.1/dist/utils/map-state.js
https://unpkg.com/viewport-mercator-project@4.1.1/dist/perspective-mercator-viewport.js
https://unpkg.com/viewport-mercator-project@4.1.1/dist/viewport.js

Naively adding https://github.com/defunctzombie/commonjs-assert to package.json or :npm-deps alone does not resolve the issue.

Environment

None

Status

Assignee

David Nolen

Reporter

Will Cohen

Labels

Approval

Vetted

Patch

Code and Test

Fix versions

Affects versions

1.9.854

Priority

Critical