使用 Closure Compiler 在 ADVANCED 模式下使用 PIXI.js 编译项目
Compile a project using PIXI.js in ADVANCED mode with Closure Compiler
我正在尝试编译一个项目,该项目使用 pixi.js 库,在高级模式下使用闭包编译器,如下所示:
You should not include a minified version of pixi during your minifying process.
Instead, you can try to include the unminified version.
https://github.com/pixijs/pixi.js/issues/1097
我正在使用这个文件(请纠正我这是不是正确的文件):
https://raw.githubusercontent.com/pixijs/pixi.js/master/bin/pixi.js
和最新的编译器 (v20151015)
--summary_detail_level 3
--warning_level VERBOSE
--compilation_level ADVANCED
--source_map_format V3
--js ... ( project files here, including pixi.js )
--js_output_file Output.min.js
编译错误:
lib/pixi.js:35: ERROR - variable exports is undeclared
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else
作为实验,我添加了@fileoverview 看看我会得到什么
/**
* @fileoverview
* @suppress {unknownDefines|checkTypes|checkVars|misplacedTypeAnnotation|nonStandardJsDocs|suspiciousCode|checkVars|accessControls|ambiguousFunctionDecl|deprecatedAnnotations|missingReturn|newCheckTypes}
*/
我得到的输出是 412 条警告(全部在 Pixi 中):
0 error(s), 412 warning(s), 61.8% typed
我不确定我是否使用了正确的 pixi.js 文件,@sbondor 正在谈论的 pixi.dev.js 文件不再在线:
https://github.com/pixijs/pixi.js/issues/1260
那么,我做错了什么?
如何编译包含 pixi.js 的项目?
我不相信 PIXI.js 与编译器的 ADVANCED
模式兼容。
但是,快速浏览一下会告诉我一些您需要用来尝试的东西:
--process_common_js_modules
PIXI 对其某些文件使用通用模块定义。编译器可以删除和重写一些 UMD 模块包装器,但您需要指定 --process_common_js_modules
标志。这也将处理 variable exports is undeclared
警告。
--common_js_entry_module
您需要使用此标志为您的应用程序指定入口模块。它是您的应用程序的基础文件。
我正在尝试编译一个项目,该项目使用 pixi.js 库,在高级模式下使用闭包编译器,如下所示:
You should not include a minified version of pixi during your minifying process.
Instead, you can try to include the unminified version.
https://github.com/pixijs/pixi.js/issues/1097
我正在使用这个文件(请纠正我这是不是正确的文件):
https://raw.githubusercontent.com/pixijs/pixi.js/master/bin/pixi.js
和最新的编译器 (v20151015)
--summary_detail_level 3
--warning_level VERBOSE
--compilation_level ADVANCED
--source_map_format V3
--js ... ( project files here, including pixi.js )
--js_output_file Output.min.js
编译错误:
lib/pixi.js:35: ERROR - variable exports is undeclared
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else
作为实验,我添加了@fileoverview 看看我会得到什么
/**
* @fileoverview
* @suppress {unknownDefines|checkTypes|checkVars|misplacedTypeAnnotation|nonStandardJsDocs|suspiciousCode|checkVars|accessControls|ambiguousFunctionDecl|deprecatedAnnotations|missingReturn|newCheckTypes}
*/
我得到的输出是 412 条警告(全部在 Pixi 中):
0 error(s), 412 warning(s), 61.8% typed
我不确定我是否使用了正确的 pixi.js 文件,@sbondor 正在谈论的 pixi.dev.js 文件不再在线:
https://github.com/pixijs/pixi.js/issues/1260
那么,我做错了什么? 如何编译包含 pixi.js 的项目?
我不相信 PIXI.js 与编译器的 ADVANCED
模式兼容。
但是,快速浏览一下会告诉我一些您需要用来尝试的东西:
--process_common_js_modules
PIXI 对其某些文件使用通用模块定义。编译器可以删除和重写一些 UMD 模块包装器,但您需要指定 --process_common_js_modules
标志。这也将处理 variable exports is undeclared
警告。
--common_js_entry_module
您需要使用此标志为您的应用程序指定入口模块。它是您的应用程序的基础文件。