With lots of help from this excellent article by Nikolas LeBlanc, I'm trying to create an Angular 4 component library:
The problem is this... my library depends on an external JavaScript file - let's call that somefunctions.js
.
In a regular Angular 4 application - I've been able to do this by referencing the file in the angular-cli.json
file:
"scripts": [
"./app/js/somefunctions.js"
],
... then declare the variables as type any
in the typings.d.ts
file.
This makes the JavaScript file available to the application, and it works just fine.
However - my goal is to create an Angular 4 component library, and package/publish it to npm.
When I follow the instructions for creating the library - the feature module is packaged without somefunctions.js
.
So - if someone else installs my module, they won't have somefunctions.js
, and it obviously won't work.
So, I guess I need to know how to tell ng-packagr to bundle the module so that it includes somefunctions.js
, and how to set up my module so that my code can reference that file when the module is installed in other applications.
Thanks in advance!