Java Reference
In-Depth Information
Package Managers
As modules have become more widely used in JavaScript, there's been a need for tools to
manage them. Package managers help to organize code into modules. They can also handle
dependency management between modules.
Browserify
A tool that uses the CommonJS Module pattern is Browserify. It can be used to package
your own modules or third-party modules downloaded and installed using the Node Package
Manager (npm). It creates a single bundle file requiring all the necessary modules, including
any dependencies. This means that you can organize all your code into separate modules,
but only need add one bundle file in your HTML file:
<script src="bundle.js"></script>
npm packages normally require Node.js to run, but Browserify can also be used to compile
npm packages into code that runs in a browser. Any of the popular libraries of code available
as npm packages can be used in web-based projects. Note that to do this, you'll need to in-
stall Node.js and the npm package manager on your own machine.
Note: Node Package Manager
If you install Node.js (which is increasingly useful to do as a modern
JavaScript developer), the Node Package Manager will be included in the
installation. This is thepackage manager for installing modules written in
Node.js. It includes a huge number of modules that can be used for a variety
of tasks.
Browserify makes it much easier to use popular frameworks such as jQuery. Instead of
downloading the framework code and then adding a script tag in the HTML file, all you
need to do is install jQuery on your system using npm and the following line in a terminal:
npm install jquery
 
Search WWH ::




Custom Search