Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Make session replay opt-in so rrweb isn't shipped when it's disabled

未关闭
#414 1 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@grootbro 已经在做这个了。

开始于 2026年9月7日。

  • #489 来自 @grootbro —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript

调研方向

首先跟踪 loadReplayModule 和现有的 replay import,然后检查 @openpanel/web 包的入口点以及 IIFE 构建中的 esbuild replay stub。比较提议的 @openpanel/web/replay 入口和 recorder 选项如何适配当前 API。当 replay 用户可以显式 import recorder,且不进行该 import 的应用不再接收 rrweb chunk 时,即表示完成;验证两种构建输出。

由索引模型根据 Issue 内容生成。

描述

@openpanel/web emits the replay chunk (rrweb, ~55 KB gz) even for apps that never set sessionReplay.enabled. #336 made it lazy, so no TTI cost, but loadReplayModule still does an unconditional import('./replay'), so the bundler always emits it and deploys it as dead code. Consumers can only drop it by stubbing rrweb or patching the package. (context: https://github.com/Openpanel-dev/openpanel/issues/336#issuecomment-4959858749)

Proposal: opt-in replay subpath

Base package stops importing ./replay; expose the recorder as @openpanel/web/replay and let consumers pass it in:

import { OpenPanel } from '@openpanel/web'
import { startReplayRecorder } from '@openpanel/web/replay'

new OpenPanel({ sessionReplay: { enabled: true, recorder: startReplayRecorder } })

rrweb then only enters a bundle when the subpath is imported. Replay users add one import, everyone else gets a lean build for free. The IIFE build already stubs replay via an esbuild plugin, so this mostly surfaces existing decoupling at the API level.

Smaller alternative if the API change is too much: a replay-free library entry or a build flag.

Follows up on #336.

主要语言
TypeScript
星标
7.1k
派生
510
平均合并
7 天 2 小时
30 天内合并 PR
7

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Openpanel-dev/openpanel 的其他 Issue

查看 Openpanel-dev/openpanel 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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