I have a web extension for firefox based on manifest_version: 2. My extension interacts with the elements of a certain third-party site, sometimes modifying them or supplementing the interface with my own elements. Recently, I needed to add the Vibrant.js library to determine the color palette of an image. Here are the ways I tried to use it:
let script = document.createElement('script');
script.src = 'https://cdnjs.cloudflare.com/ajax/libs/vibrant.js/1.0.0/Vibrant.min.js';
document.head.appendChild(script);
My problem is not only specific to vibrant, but also to most other libraries that I can't use after following the same steps.
In general, I really had everything worked out with non-minified version of the library file, but as it turned out the images from which I wanted to get information were protected from the function of working with pixels through CORS. The only thing that I managed and that works at the moment is transferring the functionality into a background script and connecting the library file as a background script.