I create my own (private) npm packages based on Angular with Typescript.
I'm creating a package with a file named pdf-viewer.service.ts with the following content:
import { BehaviorSubject, Subject } from 'rxjs';
// ....
import * as $ from 'jquery';
@Injectable({
providedIn: 'root'
})
export class PDFViewerService {
constructor() {
// $(.....)
}
}
When I place this package directly in my main project, everything is working fine.
But when I build the package and publish it to my private repo and access it from there it isn't working.
I get this error:
ERROR TypeError: (jquery__WEBPACK_IMPORTED_MODULE_0___namespace_cache || jquery__WEBPACK_IMPORTED_MODULE_0___namespace_cache) is not a function
Some background info
After building and publishing the package it creates a PDFViewer.service.d.ts with the following content:
import { BehaviorSubject, Subject } from 'rxjs';
// ....
// Note that the jquery import is missing here!!!!!!!!!!!!
@Injectable({
providedIn: 'root'
})
export declare class PDFViewerService {
constructor();
}
How can i make this work?