We are using Bokeh 2.2.3 in a setup where the @bokeh/bokehjs lib is npm installed into our Angular 9 SPA, and we are “linking” against the @bokeh/bokehjs/build/js/lib/* files. We just switched from Bokeh 2.0.2 and in 2.2.3 we started to get uncaught ReferenceErrors. Quick research told us these are typically manifestation of circular import dependencies. The attached image shows an example, with one such loop
I ran a more complete analysis on the entire lib directory of 2.2.3, using “madge” (GitHub - pahen/madge: Create graphs from your CommonJS, AMD or ES6 module dependencies), and it has found 13 circular dependency loops in the code base:
Zharaszti-mlt lib $ madge --circular .
Processed 429 files (4.1s) (28 warnings)
Found 13 circular dependencies!
- core/util/array.js > core/util/arrayable.js > core/util/types.js
- core/has_props.js > document/index.js > document/document.js > base.js
- models/index.js > models/annotations/index.js > models/annotations/annotation.js > models/renderers/renderer.js > core/visuals.js > models/canvas/canvas.js > core/has_props.js > document/index.js > document/document.js > base.js
- core/has_props.js > document/index.js > document/document.js
- core/has_props.js > document/index.js > document/document.js > document/events.js
- core/has_props.js > document/index.js > document/document.js > model.js
- models/canvas/canvas.js > core/has_props.js > document/index.js > document/document.js > models/layouts/layout_dom.js
- core/has_props.js > document/index.js > document/document.js > models/sources/column_data_source.js > models/sources/columnar_data_source.js > core/selection_manager.js
- core/visuals.js > models/canvas/canvas.js > core/has_props.js > document/index.js > document/document.js > models/sources/column_data_source.js > models/sources/columnar_data_source.js > core/selection_manager.js > models/renderers/glyph_renderer.js > models/glyphs/harea.js > models/glyphs/area.js > models/glyphs/glyph.js
- models/renderers/renderer.js > core/visuals.js > models/canvas/canvas.js > core/has_props.js > document/index.js > document/document.js > models/sources/column_data_source.js > models/sources/columnar_data_source.js > core/selection_manager.js > models/renderers/glyph_renderer.js > models/renderers/data_renderer.js
- models/sources/columnar_data_source.js > core/selection_manager.js > models/renderers/glyph_renderer.js > models/sources/cds_view.js
- models/glyphs/circle.js > models/glyphs/webgl/markers.js
- models/widgets/tables/cell_editors.js > models/widgets/tables/data_table.js > models/widgets/tables/table_column.js
Any advice?
PS In case anyone tries to run madge on the lib dir under node_modules, it will produce an empty graph, because it detects that the dependencies are under node_modules, hence ignores them. One has to copy the lib directory out to a tmp dir and run madge there. In case this helps others…




