lineupjs / lineupengine

fast scalable table renderer
https://lineupengine.js.org
MIT License
4 stars 0 forks source link

Library does not work in projects with tslib < 2.1.0 #31

Closed puehringer closed 3 years ago

puehringer commented 3 years ago

Steps to reproduce

See https://github.com/lineupjs/lineupjs/issues/423 for details.

  1. Use LineUp[Engine] in any project with a "hard" dependency of tslib < 2.1.0, i.e. "tslib": "~2.0.0"

Observed behavior

As soon as a ranking is instantiated, this error occurs and nothing works:

WARNING in ./node_modules/lineupengine/build/src/table/MultiTableRowRenderer.js 147:52-65
1570"export '__spreadArray' was not found in 'tslib'
1571 @ ./node_modules/lineupengine/build/src/table/index.js
1572 @ ./node_modules/lineupengine/build/src/index.js
1573 @ ./node_modules/lineupjs/build/src/ui/SlopeGraph.js
1574 @ ./node_modules/lineupjs/build/src/ui/index.js
1575 @ ./node_modules/lineupjs/build/src/index.js
1576 @ ./jamborees/dist/internal/ranking/RankingView.js

This is because at this line, it uses the spread operator (...[asdf, ]), which is imported from tslib as __spreadArray. The problem is that spreadArray only exists in tslib: 2.1.0 (https://github.com/microsoft/tslib/releases/tag/2.1.0), and it was previously called `spreadArrays`.

Expected behavior

I suppose LineUpEngine should work with libraries with tslib < 2.1.0.

(Possible) Solutions

We have already set importHelpers to false in LineUp, we should do the same in LineUpEngine I guess.