fix: use web-worker to replace tiny-worker and worker-loader

for webpack 5 compatibility
This commit is contained in:
Christopher Willis-Ford 2024-03-04 08:39:17 -08:00
parent 64d17098a1
commit 058685f41e
9 changed files with 1232 additions and 695 deletions

1908
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -62,7 +62,7 @@
"scratch-translate-extension-languages": "^1.0.0",
"text-encoding": "^0.7.0",
"uuid": "^8.3.2",
"worker-loader": "^1.1.1"
"web-worker": "^1.3.0"
},
"devDependencies": {
"@babel/core": "7.24.0",
@ -96,7 +96,6 @@
"stats.js": "0.17.0",
"tap": "16.3.10",
"terser-webpack-plugin": "4.2.3",
"tiny-worker": "2.3.0",
"webpack": "5.90.3",
"webpack-cli": "4.10.0",
"webpack-dev-server": "3.11.3"

View file

@ -157,10 +157,10 @@ class ExtensionManager {
return new Promise((resolve, reject) => {
// If we `require` this at the global level it breaks non-webpack targets, including tests
const ExtensionWorker = require('worker-loader?name=extension-worker.js!./extension-worker');
const worker = new Worker('./extension-worker.js');
this.pendingExtensions.push({extensionURL, resolve, reject});
dispatch.addWorker(new ExtensionWorker());
dispatch.addWorker(worker);
});
}

View file

@ -1,5 +1,5 @@
const test = require('tap').test;
const Worker = require('tiny-worker');
const Worker = require('web-worker');
const BlockType = require('../../src/extension-support/block-type');

View file

@ -1,4 +1,4 @@
const Worker = require('tiny-worker');
const Worker = require('web-worker');
const path = require('path');
const test = require('tap').test;

View file

@ -1,4 +1,4 @@
const Worker = require('tiny-worker');
const Worker = require('web-worker');
const path = require('path');
const test = require('tap').test;

View file

@ -1,4 +1,4 @@
const Worker = require('tiny-worker');
const Worker = require('web-worker');
const path = require('path');
const test = require('tap').test;
const makeTestStorage = require('../fixtures/make-test-storage');

View file

@ -1,4 +1,4 @@
const Worker = require('tiny-worker');
const Worker = require('web-worker');
const path = require('path');
const test = require('tap').test;
const makeTestStorage = require('../fixtures/make-test-storage');

View file

@ -1,5 +1,5 @@
const DispatchTestService = require('../fixtures/dispatch-test-service');
const Worker = require('tiny-worker');
const Worker = require('web-worker');
const dispatch = require('../../src/dispatch/central-dispatch');
const path = require('path');