javascript - 如何强制谷歌闭包编译器保留 "use strict";在编译的js代码中?

标签 javascript google-closure google-closure-compiler ecmascript-5

如果你正在使用模块模式并且有这样的东西:

(function () {
   "use strict";
   // this function is strict...
}());

并使用 Google Closure Compiler 编译代码,"use strict"; 指令将不会进入编译文件。

那么如何防止 Closure 编译器删除 ES5/strict 指令呢?

(注意我不想使用其他强制ES5/strict模式的模式,就是在编译文件的第一行简单的加上"use strict"; 我想使用模块模式如所述 here .)

最佳答案

关于javascript - 如何强制谷歌闭包编译器保留 "use strict";在编译的js代码中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4463035/

相关文章:

javascript - 使用 npm - 配置文件位置全局安装 jshint

java - 为什么JSON文件格式的java Path.Separator被切换为\?

javascript - 将参数从 angularJs 发送到 php symfony2 api

javascript - 如何使用 Google Closure 编译器

google-closure-compiler - 为什么 "Hello World"plovr 示例中出现 JSC_MISSING_PROVIDE_ERROR?

javascript - Google 闭包编译器和 teamcity/tfs

javascript - 当代码抛出字符串而不是错误时发出警告

javascript - 如何让一个表列在另一个移动时保持完整

javascript - Google Closure 引入错误

javascript - Google 闭包编译器不会删除标有 @define 注释的无法访问的代码