developit / developit/web-worker

`1.5.0` regression: workers treated as ESM by default

Đang mở
#55 1 bình luận 5 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
1.2k
Fork
57
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hi,

Glad to stumbled on this neat project and looking forward to using it to write more consistent browser-node code.

I'm trying to get duckdb-wasm working in node, I found a [`bare-node`](https://github.com/duckdb/duckdb-wasm/blob/main/examples/bare-node/index.cjs) example in their repo.

It fails when I run it, with error:

`ReferenceError: module is not defined`

It uses web-worker, and it seems like the worker code (clearly CJS and with file extension `cjs`) gets detected like an ESM module.

Downgrading web-worker from `1.5.0` to `1.4.1` fixes the issue. I tried a few other things like passing type: commonjs, type: classic - none worked.

Suggests a regression in 1.5.0 release (edit: unless changing the default behavior in 1.5.0 is intentional)

Thanks
Declan

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

Mở hướng dẫn đóng góp

Đá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.