Support import and require
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 42/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- testing
调研方向
首先检查 src/index.js 第 129 行附近,并使用一个同时使用 require 和 import 的第三方库重现报告中的 Jest 运行时设置。确认 jsdom-worker 能够加载使用这两种模块样式的代码,同时不破坏现有的模块使用方式;issue 提出的 createRequire 方法是评估的起点。
由索引模型根据 Issue 内容生成。
描述
I'm using jsdom-worker to support third party libs that use service workers in a jest runtime. The third party lib uses require all over the place, which causes issues when jest is otherwise configured as a module (i.e. using import). One way to solve this is to polyfill require -- for example, https://stackoverflow.com/a/71883023/3269537
import { createRequire } from "module";
const require = createRequire(import.meta.url);
It would be really convenient if jsdom-worker supported both require and import, so that it is agnostic to what code is actually being loaded. Can we simply inject the above here: https://github.com/developit/jsdom-worker/blob/main/src/index.js#L129? Happy to send out a pr that tries this
- 主要语言
- JavaScript
- 星标
- 291
- 派生
- 20
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
developit/jsdom-worker 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 35/100
developit/jsdom-worker#26 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
developit/jsdom-worker#24 · 32 条评论 · 59 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 30/100
developit/jsdom-worker#22 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 38/100
developit/jsdom-worker#20 · 2 条评论 ·
-
难度 5/5 一周以上 新手友好度 25/100
developit/jsdom-worker#19 · 2 条评论 ·
查看 developit/jsdom-worker 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
-
难度 2/5 1-3 小时 新手友好度 75/100
mksglu/context-mode#1200 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
neondatabase/website#5944 ·
-
module: core
难度 2/5 1-3 小时 新手友好度 75/100
bigbluebutton/bigbluebutton#25849 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
jaegertracing/jaeger-ui#4506 ·