我想在Chrome擴展的內容腳本中使用google封閉庫。在Chrome擴展內容腳本中使用google封閉庫
這是content_scripts看怎麼樣在的manifest.json
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": [
"closure-library/closure/goog/base.js",
"content.js"
]
}
我得到下面的錯誤:
goog.require could not find: goog.dom
我想,一個選擇是使用封閉建設者編譯內容。 js與封閉代碼並使用單個輸出文件,但我需要在content.js中的每次更改後都這樣做。
是否有任何其他方式在內容腳本中使用閉包庫?
編輯:
即使當我使用閉包生成器的方法,它不能正常工作。它試圖在當前網頁所在的域名上查找deps.js。例如。在google.com的情況下,我得到錯誤信息如下:
GET https://www.google.co.in/deps.js 404 (Not Found)
goog.writeScriptTag_
goog.importScript_
(anonymous function)