3 ms·
> but can't understand how/why you'd need a nodejs library that will provide some frontend functionalities NPM (node package manager) is a bit misleading here
by supermatt 5y ago
> but can't understand how/why you'd need a nodejs library that will provide some frontend functionalities
NPM (node package manager) is a bit misleading here as they arent necessarily modules FOR node. They are often just javascript modules (usually in commonJS format) conforming to the NPM package format.
> How does it work ?
The files, including your code and the referenced modules and their dependencies (usually) go through a build step (using 3rd party tools), which creates a single (but can be multiple) file containing (effectively) a map of all the bundled files and a function to handle the module loading. This file is then run in the browser (which will either execute the program, or expose the programs API/entrypoints in some way).
i.e. it allows you to create your code in a structured way, but then "bundles" up the code in a way to run it in the browser.