I am using a very large library in my spfx solution and I would like to not only share it among webparts within this app but share it across any other webparts that might be using this library.
What I know
- I know that you can include external libraries such as jquery and some libraries that have typings separate from their npm package.
- I know that even if I put a reference to an external library in the externals section it won't actually pull down the library if I don't import it anywhere in my code.
- I understand the current examples in the documentation. I managed to successfully use moment-timezone which is great.
Problem I am having
I am trying to use the DevExtreme and devextreme-react libraries. This library is very large so I want to include it once from a cdn when a webpart is requesting it and continue using the same script with each additional webpart instance. The problem is that the library comes with typings included in it. It is in a subfolder bundles/dx.all.d.ts instead of in its own package. It also has multiple files you can include instead of including the entire library. In addition the devextreme-react is depending on the devextreme library so it is also including files from devextreme.
The project either doesn't load the external libraries because I don't include them, or things fail to compile because I am not importing it properly..? maybe?
My question is how do I exclude the library, add it to externals configuration, import it into my project files with typings and still have my project compile?