Create workers using new webpack 5 syntax

Drop worker-loader which isn't needed anymore.
This commit is contained in:
Tyler Hallada 2022-03-19 01:15:25 -04:00
parent 6527c6d5f7
commit 38d3536340
3 changed files with 119 additions and 212 deletions

View File

@ -6,7 +6,6 @@ import {
PluginFile, PluginFile,
} from "../slices/plugins"; } from "../slices/plugins";
import store from "./store"; import store from "./store";
import { default as Worker } from "worker-loader?filename=static/[fullhash].worker.js!../workers/PluginsLoader.worker";
export interface Task { export interface Task {
skipParsing: boolean, skipParsing: boolean,
@ -40,7 +39,7 @@ export class WorkerPool {
public async createWorker(): Promise<Worker> { public async createWorker(): Promise<Worker> {
return new Promise((resolve) => { return new Promise((resolve) => {
const worker = new Worker(); const worker = new Worker(new URL("../workers/PluginsLoader.worker.ts", import.meta.url));
worker.onmessage = (evt: { worker.onmessage = (evt: {
data: string | PluginFile; data: string | PluginFile;
}) => { }) => {

325
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -33,7 +33,6 @@
"eslint-config-next": "12.0.8", "eslint-config-next": "12.0.8",
"next-sitemap": "^2.1.14", "next-sitemap": "^2.1.14",
"node-fetch": "^3.2.0", "node-fetch": "^3.2.0",
"typescript": "4.5.4", "typescript": "4.5.4"
"worker-loader": "3.0.8"
} }
} }