File tree 1 file changed +7
-3
lines changed
1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -368,13 +368,17 @@ module.exports = function () {
368
368
function initialize ( success , error ) {
369
369
if ( scanWorker === null ) {
370
370
// Automatic public path doesn't work here with the complicated build and cordova magic.
371
- // We derive our own public path based on injected environment variable.
371
+ // We derive our own public path based on injected environment variable, or a runtime
372
+ // global variable. The environment variable is used by cordova test framework.
373
+ // The global variable is used when using the internal implementation directly in
374
+ // another application without using cordova.
372
375
// After instantiating the url, we set it back to its original value.
373
376
// https://mmazzarolo.com/blog/2021-09-03-loading-web-workers-using-webpack-5/
374
377
const original__webpack_public_path__ = __webpack_public_path__ ;
375
378
376
- if ( process . env . WORKER_PUBLIC_PATH !== null ) {
377
- __webpack_public_path__ = process . env . WORKER_PUBLIC_PATH ;
379
+ const worker_public_path = window . QRSCANNER_WORKER_PUBLIC_PATH || process . env . WORKER_PUBLIC_PATH
380
+ if ( worker_public_path !== null ) {
381
+ __webpack_public_path__ = worker_public_path ;
378
382
}
379
383
380
384
scanWorker = new Worker (
You can’t perform that action at this time.
0 commit comments