As I integrate some "legacy" (non-typescript) JavaScript libraries into my Angular single page application.
Usually, I simply include a CDN link in the index.html file like this:
<script src="//cdnjs.cloudflare.com/ajax/libs/pako/1.0.6/pako.min.js"></script>
and then declare it in the Angular component like this:
declare var pako: any;
This method usually works fine. Now, I want to host this library locally. I can add it to the Angular project using:
npm install pako
But how do I then add it to the Angular app?
I tried adding an import to polyfills.ts (which worked for hammerjs but not for pako)
Additionally, this approach should work for ng build (and then likely be included in the compiled/packed runtime.js)
By the way, here is a test stackblitz https://stackblitz.com/edit/ng-load-pako