0
votes

I am developing a chrome extension that uses firebase in content script. Based on this answer I decided to store it locally in my /lib folder. Whether I download it with npm, bower or from gstatic, I always end up with binary files with chrome doesn't want to use as libraries ("Could not load file "some_filename.js" for content script. It isn't UTF-8 encoded.")

I tried converting it with iconv, Sublime, TextEdit, tried this and couple of others, nothing worked, file -I always claims that file is binary.

Is there any other way I can obtain firebase.js file, or convert the existing binary files to utf-8?

1
To anyone interested, the issue with converting the firebase.js to utf-8 and workaround is explained heremlkwrz

1 Answers

0
votes

Actually, it is not a good idea to load the firebase bundle in a content-script.
It will slow tabs loading, even if it is taken from disk. Because it still needs time to parse and process JS code.

Good practice will be to include firebase to the background page and implement a communication using messages between background and content-script.
Setting charset to utf-8 in the background page should solve the problem.