developit / developit/web-worker

`1.5.0` regression: workers treated as ESM by default

未关闭
#55 1 条评论 5 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
JavaScript
星标
1.2k
派生
57
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。