The top-level output key contains set of options instructing webpack on how and where it should output your bundles, assets and anything else you bundle or load with webpack.
default: string = 'var'
Configure how the library will be exposed.
Please note that this option works in conjunction with the value assigned to
Expose a Variable
These options assign the return value of the entry point (e.g. whatever the entry point exported) to the name provided by output.library at whatever scope the bundle was included at.
libraryTarget: 'var' - (default) When your library is loaded, the return value of your entry point will be assigned to a variable:
var MyLibrary = _entry_return_; // In a separate script... MyLibrary.doSomething();
- When using this option, an empty output.library will result in no assignment.
- https://github.com/webpack/webpack/issues/1114 CommonJs spec defines only exports. But module.exports is used by node.js and many other CommonJs implementations.
commonjs mean pure CommonJs commonjs2 also includes the module.exports stuff.o