收到错误Could not load file 'worker.js' for content script. It isn't UTF-8 encoded.
> file -I chrome/worker.js
chrome/worker.js: text/plain; charset=utf-8
With 转 utf8-unix https://www.npmjs.com/package/to-utf8-unix
> to-utf8-unix chrome/worker.js
chrome/worker.js
----------------
Detected charset:
UTF-8
Confidence of charset detection:
100
Result:
Conversion not needed.
----------------
我还尝试使用 Sublime Text 来回转换文件,但没有任何运气。
显现:
"content_scripts": [{
"matches": ["http://foo.com/*"],
"js": ["worker.js"]
}],
有问题的文件:https://www.dropbox.com/s/kcv23ooh06wlxg3/worker.js?dl=1 https://www.dropbox.com/s/kcv23ooh06wlxg3/worker.js?dl=1
它是用 cljsbuild 从 clojurescript 中吐出的编译后的 javascript 文件:
{:id "chrome-worker"
:source-paths ["src/chrome/worker"],
:compiler {:output-to "chrome/worker.js",
:optimizations :simple,
:pretty-print false}}
]}
其他文件(选项页面、背景)以相同的方式编译,不会生成此错误。我尝试摆脱像表情符号这样的奇怪字符,但这并没有解决问题。