Tesseract – Use in Browser Console

I am trying to use Tesseract within the browser console. This is for a site for which is not my own so I cannot embed external scripts for security reasons, hence why I run my code in the browser console. However, it is only for personal use and for intention of reading data from a canvas image.

I embedded the JS from ‘https://cdn.jsdelivr.net/npm/[email protected]/dist/tesseract.min.js’ and then ran the following from the examples page of Tesseract GitHub pages:

(async () => {
const worker = await createWorker('eng');
const ret = await worker.recognize('https://tesseract.projectnaptha.com/img/eng_bw.png');
console.log(ret.data.text);
await worker.terminate();
})();

Which produces the following error (also because of security issues.): ‘VM11097:6 Uncaught (in promise) Uncaught NetworkError: Failed to execute ‘importScripts’ on ‘WorkerGlobalScope’: The script at ‘https://cdn.jsdelivr.net/npm/[email protected]/dist/worker.min.js’ failed to load.’

Is it possible to compile the Tesseract JS files into a single block of code? Essentially, I want to bypass anything which involves referencing an external source.

Many thanks, greatly appreciated.