andywer / andywer/threads.js

Can't get threads.js working with TypeScript/React/Webpack 5

Đang mở
#387 15 bình luận 0 reaction 0 người được giao Xem trên GitHub
question
Ngôn ngữ chính
TypeScript
Star
3.5k
Fork
173
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hello,

I've tried quite a few things but I just can't get even a minimal example of threads.js working with React/Typescript/Webpack5. I followed the documentation, added the threads-plugin to webpack. I uploaded the repo on my GitHub: https://github.com/achimcc/threads_example

Running yarn start, I receive a warning:

> WARNING in No instantiations of threads.js workers found.
> Please check that:

> 1. You have configured Babel / TypeScript to not transpile ES modules
> 2. You import `Worker` from `threads` where you use it

> For more details see: https://github.com/andywer/threads-plugin

While the Chrome console is reporting some errors:

5e513c3f-5e23-4eff-ae53-e43b68f8daf7:1 Refused to execute script from 'http://localhost:8080/4cbcab03c903775de194.ts' because its MIME type ('video/mp2t') is not executable.
(anonymous) @ 5e513c3f-5e23-4eff-ae53-e43b68f8daf7:1
5e513c3f-5e23-4eff-ae53-e43b68f8daf7:1 Uncaught DOMException: Failed to execute 'importScripts' on 'WorkerGlobalScope': The script at 'http://localhost:8080/4cbcab03c903775de194.ts' failed to load.
at blob:http://localhost:8080/5e513c3f-5e23-4eff-ae53-e43b68f8daf7:1:1

I would highly appreciate any advice! Or is there perhaps a sample repo for a minimal TypeScript/Webpack5 setup?

Many thanks in advance,
Achim

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.