For more information on "module bundle" loading, read the What does "module loading" mean FAQ.
Table of Contents:
For the most part, you don't actually use
js-modules directly (aside from installing the package). In general,
you use it via
js-builder i.e. you use
js-builder to build browser-loadable bundles, and those
bundles will use
js-modules to load/"import" the modules/packages that they depend on, but do not contain
within their bundle.
npm install --save @jenkins-cd/js-modules
js-modules, your next step is to start using js-builder and, as stated above, that's
mostly all you'll ever need to know about
js-modules because the rest of it happens under the hood via
That said, it's probably useful to have an understanding of how
js-modules actually loads modules/packages.
For that, take a look at MODULE_LOADING.md.
As we see it, the main issues today are:
JenkinsRule(HtmlUnit and it's
These are the problems that
js-modules (this NPM package) is targeted at helping to solve.
It is hoped that
js-modules will help those that are interested (see next section) in maintaining modular,
is more immune to plugin updates etc (e.g. an upgrade to the
jQuery plugin doesn't break the plugin GUI).
Using CommonJS style modularity also makes it possible to more easily leverage the growing set of publicly available
NPM/node.js packages, which is a huge benefit.
What do we mean by "evolvable"?:
js-modules) to depend on an explicit version of a JS lib that is guaranteed to remain available on e.g. plugin upgrades. Conversely, the same modular code can upgrade the version of a lib it depends on without effecting other modular code that still depends on an older version.
No, this is totally optional. See FAQ
The following slides attempt to bring you through
js-modules in some more detail.
Also check out the FAQs.
The following NPM packages are designed to aid the use and adoption of
js-modules. This package's functionality is indirectly available via js-builder.
As stated earlier, using CommonJS style modularity makes it possible to more easily leverage the growing set of publicly available
NPM/node.js packages. If you want to use some really cool NPM package that you just found, all you need to do is follow the
"standard" NPM package installation process, adding it to your "app" bundle e.g.
npm install --save cool-new-lib.
The main feature of
js-modules is it's ability to load module bundles that can
import modules to/from
other modules bundles i.e. share common modules between bundles (see above slides). This means we can create
"app" bundles to share common Framework libs and to not have them in their "app" bundle, making them considerably lighter for
browser load and helping to avoid the bundle bloat problem.