如果您正在使用模块模式并具有以下内容:
(function () {
"use strict";
// this function is strict...
}());
Run Code Online (Sandbox Code Playgroud)
并使用Google Closure Compiler编译代码,该"use strict";指令不会使其进入编译文件.
那么如何防止Closure Compiler删除ES5/strict指令呢?
(注意,我不想使用强制执行ES5 /严格模式的其他模式,即简单地将"use strict";添加到编译文件的第一行.我想使用此处所述的模块模式.)
javascript google-closure google-closure-compiler ecmascript-5