Webpack
is a bundler. Like Browserfy
it looks in the codebase for module requests (require
or import
) and resolves them recursively. What is more, you can configure Webpack
to resolve not just JavaScript-like modules, but CSS, images, HTML, literally everything. What especially makes me excited about Webpack
, you can combine both compiled and dynamically loaded modules in the same app. Thus one get a real performance boost, especially over HTTP/1.x. How exactly you you do it I described with examples here http://dsheiko.com/weblog/state-of-javascript-modules-2017/
As an alternative for bundler one can think of Rollup.js
(https://rollupjs.org/), which optimizes the code during compilation, but stripping all the found unused chunks.
For AMD
, instead of RequireJS
one can go with native ES2016 module system
, but loaded with System.js
(https://github.com/systemjs/systemjs)
Besides, I would point that npm
is often used as an automating tool like grunt
or gulp
. Check out https://docs.npmjs.com/misc/scripts. I personally go now with npm scripts only avoiding other automation tools, though in past I was very much into grunt
. With other tools you have to rely on countless plugins for packages, that often are not good written and not being actively maintained. npm
knows its packages, so you call to any of locally installed packages by name like:
{
"scripts": {
"start": "npm http-server"
},
"devDependencies": {
"http-server": "^0.10.0"
}
}
Actually you as a rule do not need any plugin if the package supports CLI.