Open dave-doty opened 4 years ago
I had difficulty finding resources for how to incorporate npm packages into dart applications. Many answers I found seem to suggest that there is no way to do this and it is not recommended.
I had difficulty finding resources for how to incorporate npm packages into dart applications. Many answers I found seem to suggest that there is no way to do this and it is not recommended.
That's disappointing. I'm surprised the Dart team is so behind on that.
Currently, all third-party Javascript libraries are in web/external-libs and are imported in web/index.html:
Each of these is a single file that creates global variables. This works but is not current recommended practice for Javascript.
There's a more modern way of installing and importing Javascript libraries, using npm, or yarn. (or both? I don't really understand them very well.) For instance, the react-svg-pan-zoom has them as two options for installing.
This will give a simpler way to update packages and avoid namespace collisions, and also some libraries (such as react-svg-pan-zoom) don't even have the option to include one giant file with global variables.