From 49ab61ca0830aaa48322a3a7dee9c6fab03745c9 Mon Sep 17 00:00:00 2001 From: Arild Matsson Date: Thu, 29 Feb 2024 17:42:40 +0100 Subject: [PATCH] Fix worker reference --- app/scripts/statistics.js | 2 +- app/scripts/statistics_worker.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/scripts/statistics.js b/app/scripts/statistics.js index 5c64ef1a2..f3a70d0fa 100644 --- a/app/scripts/statistics.js +++ b/app/scripts/statistics.js @@ -97,7 +97,7 @@ const createStatisticsService = function () { ) { const columns = createColumns(data.corpora, reduceVals, reduceValLabels) - const statsWorker = new Worker("worker.js") + const statsWorker = new Worker(new URL("./statistics_worker.ts", import.meta.url)) statsWorker.onmessage = function (e) { const searchParams = { reduceVals, diff --git a/app/scripts/statistics_worker.ts b/app/scripts/statistics_worker.ts index 39c737c62..3943e1e00 100644 --- a/app/scripts/statistics_worker.ts +++ b/app/scripts/statistics_worker.ts @@ -15,6 +15,9 @@ import { StatsData, RowsEntity, Value } from "./interfaces/stats" onmessage = function (e) { const data: StatsData = e.data.data + // Ignore messages sent by WebPack dev server. + if (e.data.type?.includes("webpack")) return + const { combined, corpora, count } = data const reduceVals: string[] = e.data.reduceVals const groupStatistics: string[] = e.data.groupStatistics