Reputation: 257
I have searched Google and Stackoverflow. I feel like my question would be common, so perhaps I am not using the proper search terms.
In my Angular 5 Project, I have added pdfmake by running npm i --save pdfmake
. This has added the expected .js files to /node_modules/pdfmake/dist. One of these files is called vfs_fonts.js which I have updated following instructions on the pdfmake website so that I can add my own fonts.
So, being new to Angular 5 and node, my question is this: should I simply overwrite the vfs_fonts.js file which exists in /node_modules/pdfmake/dist? This seems wrong to me since if I were to install my project on another machine, npm install
would not get my customization.
What is the proper way for me to override this .js file in my node_modules? Do I need to pull pdfmake out of my node_modules to create a custom package which I include in my .angula-cli.js? I hesitate to do this because I would rather not lose all the benefits of npm.
Thanks!
Upvotes: 2
Views: 712
Reputation: 4993
If you edit the code in node_modules but whenever you will do npm install it will restore back to old changes.
Best option is you can fork the package repository. You can install items directly from GitHub using NPM, and this method would let you integrate future changes into your custom version from the original source.
And then you can use this:
npm install https://github.com/<username>/<repository>/master
Hope this solves your issue.
Upvotes: 1