My new job involves mostly frontend work with various js libraries like ReactJS. I ran into the issue of wanting to include jquery.csv.js into a project and felt that existing documentation was lacking. Most google searches returned how to use something from a CDN. Our systems need to be able to run offline in the middle of Africa. A CDN isn’t going to cut the mustard.
First, get the library:
npm install jquery-csv --save
Now we make a reference to it in webpack.config.js
resolve: { alias: { .... 'jquery-csv': path.resolve('./node_modules/jquery-csv') } }
FInally we tell the application about it (in app.js if you want)
require('jquery-csv')
Restarting the server and checking the console, I can reference $.csv to my heart’s desire.