Tag: 谷歌封闭编译器

在使用Google Closure Compiler,webpack和Firebase JS SDK编译js时出现JSC_NON_GLOBAL_DEFINE_INIT_ERROR

使用下面的工具编译js时会出现JSC_NON_GLOBAL_DEFINE_INIT_ERROR: webpack:3.5.6 Google Closure Compiler JS:20170806.0.0 Firebase JS SDK:4.3.1 环境 MacOS X:10.11.6 node.js:v7.10.0 npm:4.2.0 这是错误消息: ERROR in app.bundle.js:5325 (JSC_NON_GLOBAL_DEFINE_INIT_ERROR) @define variable assignment must be global 与webpack.config.js如下所示: module.exports = { plugins: [ new ClosureCompiler({ options: { languageIn: 'ECMASCRIPT6', languageOut: 'ECMASCRIPT3', compilationLevel: 'SIMPLE_OPTIMIZATIONS', warningLevel: 'QUIET' } }) ] 这个错误是由于@define / utils / constants.js中的@define注解引起的。 var CONSTANTS = exports.CONSTANTS […]