I have a library that has the following definition:
(function (root, factory) {
if (typeof module === "object" && module.exports) {
// Node, or CommonJS-Like environments
module.exports = factory(require("lodash"), require("conduitjs"), this);
} else if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
define(["lodash", "conduitjs"], function (_, Conduit) {
return factory(_, Conduit, root);
});
} else {
// Browser globals
root.postal = factory(root._, root.Conduit, root);
}
}(this, function (_, Conduit, global, undefined)
When WebPack detects these definitions, it includes both (webpack)/buildin/amd-options.js
and (webpack)/buildin/module.js
. I get that its doing this because both CommonJs and AMD are at play, but I don’t get why they are needed in the first place given that WebPack supports these (with my normal modules) without the need for this.
Blame the module…
Here is a config that disables AMD for all node_modules: