im importing some "legacy" (non typescript) js libs to my angular SPA.
normally I just add a load from the cdn to index.html like:
<script src="//cdnjs.cloudflare.com/ajax/libs/pako/1.0.6/pako.min.js"></script>
and in the angular-component i just decale
declare var pako: any;
this typically works. Now i like to "host" this lib locally. I can add it to the angular project with
npm install pako
But how do I add it than to the angular app ?
I tested adding an import to polyfills.ts (this works for hammerjs but not for pako)
Also this should work for ng build (and than probably get added to the compiled / packed runtime.js
BTW: here is a test stackblitz https://stackblitz.com/edit/ng-load-pako
I love all the questions that provide a stackblitz link so that I can easily provide the correct answer:
https://stackblitz.com/edit/ng-load-pako-gfunsb
Basically, you just need to do:
import * as pako from 'pako';