Whenever there's a comment at the last line of a script, no final semicolon (;) will be added even if the script needs it. When concatenated with the next script, the lack of this final semicolon leads to fatal issues.
Consider the following two scripts:
(function() {
console.log('ok1');
})()
// some comment
(function() {
console.log('ok2');
})()
Since the last line of script 1 has a comment, no semicolon is added and the final resulting script is interpreted as:
throwing a Uncaught TypeError: (intermediate value)(...) is not a function.
And before anyone says that this is most probably an issue with the source scripts, the actual case which led me to find this issue is a source map comment automatically added to the end of some scripts.
More specifically, for me, that was the shadycss shim required by the polymer 2.0 core.
Whenever there's a comment at the last line of a script, no final semicolon (
;
) will be added even if the script needs it. When concatenated with the next script, the lack of this final semicolon leads to fatal issues.Consider the following two scripts:
Since the last line of script 1 has a comment, no semicolon is added and the final resulting script is interpreted as:
throwing a
Uncaught TypeError: (intermediate value)(...) is not a function
.And before anyone says that this is most probably an issue with the source scripts, the actual case which led me to find this issue is a source map comment automatically added to the end of some scripts.
More specifically, for me, that was the shadycss shim required by the polymer 2.0 core.