amdcheck loader for webpack
Uses AST to find and remove unused dependencies in AMD modules.
Installation
npm install amdcheck-loader
Usage
source.js
; ;
example.js
var output = ;// => returns optimized source (unused dependencies removed).console;
output
define('module1', ['p1'], function (a) {
/**
* b is not used in this scope.
*/
return (function(b) {
return b;
})(a);
});
define('module2', ['p2'], function (b) {
return b;
});
Don't forget to polyfill require
if you want to use it in node.
See webpack
documentation.
License
MIT (http://www.opensource.org/licenses/mit-license.php)