Skip to content

Commit 493f6e9

Browse files
author
Sean Larkin
committed
Was noticing undefined comments in cases, this fixes that
1 parent c3198a9 commit 493f6e9

1 file changed

Lines changed: 38 additions & 4 deletions

File tree

‎lib/UmdMainTemplatePlugin.js‎

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ UmdMainTemplatePlugin.prototype.apply = function(compilation) {
9595
return JSON.stringify(replaceKeys([].concat(library).pop()));
9696
}
9797

98+
function getAuxiliaryComment(commentKeyName) {
99+
return(this.auxiliaryComment &&
100+
typeof this.auxiliaryComment === 'string' ?
101+
" //" + this.auxiliaryComment + "\n" :
102+
this.auxiliaryComment[commentKeyName] ?
103+
" //" + this.auxiliaryComment[commentKeyName] + "\n" :
104+
""
105+
)
106+
}
107+
98108
var amdFactory;
99109
if(optionalExternals.length > 0) {
100110
amdFactory = "function webpackLoadOptionalExternalModuleAmd(" + externalsArguments(requiredExternals) + ") {\n" +
@@ -110,10 +120,22 @@ UmdMainTemplatePlugin.prototype.apply = function(compilation) {
110120

111121
return new ConcatSource(new OriginalSource(
112122
"(function webpackUniversalModuleDefinition(root, factory) {\n" +
113-
(this.auxiliaryComment && typeof this.auxiliaryComment === 'string' ? " //" + this.auxiliaryComment + "\n" : (" //" + this.auxiliaryComment.commonjs2 + "\n" || "")) +
123+
(this.auxiliaryComment &&
124+
typeof this.auxiliaryComment === 'string' ?
125+
" //" + this.auxiliaryComment + "\n" :
126+
this.auxiliaryComment.commonjs2 ?
127+
" //" + this.auxiliaryComment.commonjs2 + "\n" :
128+
""
129+
) +
114130
" if(typeof exports === 'object' && typeof module === 'object')\n" +
115131
" module.exports = factory(" + externalsRequireArray("commonjs2") + ");\n" +
116-
(this.auxiliaryComment && typeof this.auxiliaryComment === 'string' ? " //" + this.auxiliaryComment + "\n" : (" //" + this.auxiliaryComment.amd + "\n" || "")) +
132+
(this.auxiliaryComment &&
133+
typeof this.auxiliaryComment === 'string' ?
134+
" //" + this.auxiliaryComment + "\n" :
135+
this.auxiliaryComment.amd ?
136+
" //" + this.auxiliaryComment.amd + "\n" :
137+
""
138+
) +
117139
" else if(typeof define === 'function' && define.amd)\n" +
118140
(requiredExternals.length > 0 ?
119141
(this.name && this.namedDefine === true ?
@@ -126,12 +148,24 @@ UmdMainTemplatePlugin.prototype.apply = function(compilation) {
126148
)
127149
) +
128150
(this.name ?
129-
(this.auxiliaryComment && typeof this.auxiliaryComment === 'string' ? " //" + this.auxiliaryComment + "\n" : (" //" + this.auxiliaryComment.commonjs + "\n" || "")) +
151+
(this.auxiliaryComment &&
152+
typeof this.auxiliaryComment === 'string' ?
153+
" //" + this.auxiliaryComment + "\n" :
154+
this.auxiliaryComment.commonjs ?
155+
" //" + this.auxiliaryComment.commonjs + "\n" :
156+
""
157+
) +
130158
" else if(typeof exports === 'object')\n" +
131159
" exports[" + libraryName(this.name) + "] = factory(" + externalsRequireArray("commonjs") + ");\n" +
132160
" else\n" +
133161
" " + replaceKeys(accessorAccess("root", this.name)) + " = factory(" + externalsRootArray(externals) + ");\n" :
134-
(this.auxiliaryComment && typeof this.auxiliaryComment === 'string' ? " //" + this.auxiliaryComment + "\n" : (" //" + this.auxiliaryComment.root + "\n" || "")) +
162+
(this.auxiliaryComment &&
163+
typeof this.auxiliaryComment === 'string' ?
164+
" //" + this.auxiliaryComment + "\n" :
165+
this.auxiliaryComment.root ?
166+
" //" + this.auxiliaryComment.root + "\n" :
167+
""
168+
) +
135169
" else {\n" +
136170
(externals.length > 0 ?
137171
" var a = typeof exports === 'object' ? factory(" + externalsRequireArray("commonjs") + ") : factory(" + externalsRootArray(externals) + ");\n" :

0 commit comments

Comments
 (0)