menu
announcement

Spectrum is now read-only. Learn more about the decision in our official announcement.

Parcel

📦🚀 Blazing fast, zero configuration web application bundler

Channels
Team

Hi, I'm trying to get web workers working in Parcel 2

May 6, 2020 at 9:58am

Hi, I'm trying to get web workers working in Parcel 2

May 6, 2020 at 9:58am
In my code I've got a line:
const BackgroundWorker = new Worker('../transactionWorker.ts');
This gets loaded but the top of that file has importScripts('...a css file') which means I get an error when the worker is loaded:
Refused to execute script from '.../web.3fc80d44.css' because its MIME type ('text/css') is not executable.
(anonymous) @ transactionWorker.ef5187b4.js:1
transactionWorker.ef5187b4.js:1 Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at '.../web.3fc80d44.css' failed to load.
Does anyone have any experience with this please?

June 14, 2020 at 5:32pm
I am having the same issue. Any lead?

January 25, 2021 at 5:53am
I've switched to nightly instead of next which fixed this issue. However I'm dealing with other bugs around nightly so Your Mileage May Vary