Reputation: 3
I'm working on a Chrome extension and it's almost done. It uses CryptoJS, though, and I was wondering if it's okay to have those files (eg sha1.js) inside the extension package when I publish it (I downloaded CryptoJS and copied the SHA script file into the extension directory.)
The alternative of course would be to include the URL in the script tag but that didn't work right off the bat.
Any help would be appreciated.
Upvotes: 0
Views: 2910
Reputation: 5055
If anyone want to use manifest 3, it can be only one service worker registered in the manifest:
"background": {
"service_worker": "background.js"
}
in the background.js (service worker), other libs can be imported as follow:
try {
importScripts("/node_modules/crypto-js/crypto-js.js");
} catch (e) {
console.error(e);
}
Upvotes: 0
Reputation: 77541
There are pros and cons. Mostly pros.
However, it will be up to you to keep the library updated.
Upvotes: 1
Reputation: 792
I've done this, but only tested on my dev machine, not publishing to the Chrome Web Store. You just have to include it in your manifest.json file:
{
...
"background": {
"scripts": [
"cryptojs.js",
"main.js"]
}
...
}
Upvotes: 1