extern chrome extensions API的最佳方法,与Closure编译器高级优化一起使用?

Ale*_*tri 8 google-closure-compiler google-chrome-extension

有没有一种简单的方法可以在我的Chrome扩展程序代码中使用高级优化?

它使用chrome API,而Advanced Optimization不会重新识别其关键字.是否有文件或其他东西可以驱逐所有chrome API?

Rob*_*b W 17

每当您需要externs文件时,请查看closure-compiler存储库的contrib/externs目录.Chrome扩展程序的externs位于contrib/externs/chrome_extensions.js,可以按如下方式使用:

// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @externs_url https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/chrome_extensions.js
// ==/ClosureCompiler==

// Your code here.
Run Code Online (Sandbox Code Playgroud)