@@ -24,6 +24,7 @@ function UmdMainTemplatePlugin(name, options) {
2424 this . name = name ;
2525 this . optionalAmdExternalAsGlobal = options . optionalAmdExternalAsGlobal ;
2626 this . namedDefine = options . namedDefine ;
27+ this . auxiliaryComment = options . auxiliaryComment ;
2728}
2829module . exports = UmdMainTemplatePlugin ;
2930UmdMainTemplatePlugin . prototype . apply = function ( compilation ) {
@@ -109,8 +110,22 @@ UmdMainTemplatePlugin.prototype.apply = function(compilation) {
109110
110111 return new ConcatSource ( new OriginalSource (
111112 "(function webpackUniversalModuleDefinition(root, factory) {\n" +
113+ ( this . auxiliaryComment &&
114+ typeof this . auxiliaryComment === 'string' ?
115+ " //" + this . auxiliaryComment + "\n" :
116+ this . auxiliaryComment . commonjs2 ?
117+ " //" + this . auxiliaryComment . commonjs2 + "\n" :
118+ ""
119+ ) +
112120 " if(typeof exports === 'object' && typeof module === 'object')\n" +
113121 " module.exports = factory(" + externalsRequireArray ( "commonjs2" ) + ");\n" +
122+ ( this . auxiliaryComment &&
123+ typeof this . auxiliaryComment === 'string' ?
124+ " //" + this . auxiliaryComment + "\n" :
125+ this . auxiliaryComment . amd ?
126+ " //" + this . auxiliaryComment . amd + "\n" :
127+ ""
128+ ) +
114129 " else if(typeof define === 'function' && define.amd)\n" +
115130 ( requiredExternals . length > 0 ?
116131 ( this . name && this . namedDefine === true ?
@@ -123,8 +138,22 @@ UmdMainTemplatePlugin.prototype.apply = function(compilation) {
123138 )
124139 ) +
125140 ( this . name ?
141+ ( this . auxiliaryComment &&
142+ typeof this . auxiliaryComment === 'string' ?
143+ " //" + this . auxiliaryComment + "\n" :
144+ this . auxiliaryComment . commonjs ?
145+ " //" + this . auxiliaryComment . commonjs + "\n" :
146+ ""
147+ ) +
126148 " else if(typeof exports === 'object')\n" +
127149 " exports[" + libraryName ( this . name ) + "] = factory(" + externalsRequireArray ( "commonjs" ) + ");\n" +
150+ ( this . auxiliaryComment &&
151+ typeof this . auxiliaryComment === 'string' ?
152+ " //" + this . auxiliaryComment + "\n" :
153+ this . auxiliaryComment . root ?
154+ " //" + this . auxiliaryComment . root + "\n" :
155+ ""
156+ ) +
128157 " else\n" +
129158 " " + replaceKeys ( accessorAccess ( "root" , this . name ) ) + " = factory(" + externalsRootArray ( externals ) + ");\n" :
130159 " else {\n" +
0 commit comments