Occasionally, we need to use a JS library in our browser side, yet it’s only available from the NPM repository.
As usual, the Google result of any NPM related questions will bring you more yes-and-no answers, and leave you in further confusions and headaches.
Well, life better be simpler :)
Say, we are going to use the NPM library of
buffer in the browser, all we need to do is:
1. install browserify tool
2. install npm libraries
3. create a new JS file,
default is needed for
emailjs-mime-parser because of
legacy export syntax.)
4. compile the
bundle.js in normal webpage, and you could use
Buffer in the browser side JS:
And that’s all :)