I am developing multiple websites in angular with similar content and have therefore decided to extract common components and functionality into a separate angular 13 library.
I have previously successfully used the JSZip library in one of these websites, but have then decided to move this implementation into the library.
Even though the code did not change, it stopped working.
If I try to call the method that uses JSZip from the library it now throws the following TypeError
ERROR TypeError: (jszip__WEBPACK_IMPORTED_MODULE_1___namespace_cache || jszip__WEBPACK_IMPORTED_MODULE_1___namespace_cache) is not a constructor
When I try to create a new JSZip instance like this
const zip = new JSZip();
Based on this question the problem might be in how I import the library. I do it like this
import * as JSZip from 'jszip';
And according to this question that is how it should be done.
Both the library and the website projects build correctly but throw this error at runtime, so I don't think it is a problem with dependencies.
Has someone encountered a similar problem before? What should I try to solve this?