Warning when recompile material.components.js with closure compiler
nikolaysm opened this issue · comments
Hi @kmmbvnr ,
I get a warning when compiling of materialize.components.js.
Here is an issue: google/closure-compiler#2046 (comment)
From https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode#invoking_strict_mode:
Strict mode applies to entire scripts or to individual functions. It doesn't apply to block statements enclosed in {} braces; attempting to apply it to such contexts does nothing. eval code, Function code, event handler attributes, strings passed to setTimeout(), and related functions are entire scripts, and invoking strict mode in them works as expected.
'use strict'
doesn't make sense in this case so.?
materialize.components.js file is already compiled from many sources
"use strict" looks like completely legitimate construct
Seems most of "use strict" added by babel
https://stackoverflow.com/questions/33821312/how-to-remove-global-use-strict-added-by-babel
Probably material build process could be improved to fix this
materialize.components.js file is already compiled from many sources
"use strict" looks like completely legitimate construct
'use strict'
doesn't make sense as a directive unless it's the first line of a file or the first line of a function.
The correct use is then:
(function () {
'use strict'; ⬅️ HERE
if ( // No Reflect, no classes, no need for shim because native custom elements
// require ES2015 classes or Reflect.
...
})();