reactjs / reactjs/react.dev

[Typo]: React Compiler Vite installation docs with "vite-plugin-babel" cause sourcemap issues

未关闭
#8,215 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

type: typos
主要语言
JavaScript
星标
11.8k
派生
7.9k
平均合并
1 天 11 小时
30 天内合并 PR
11

描述

Summary

When following the setup instructions for React Compiler on the current live docs site, if using a custom Vite Babel plugin + React SWC or React Router v7 framework mode, you will notice that if a component gets optimized by React Compiler, the sourcemaps appear to have some React Compiler-optimized code paths in them, making dev debugging more difficult.

Page

https://react.dev/learn/react-compiler/installation

Details

Please see reproduction repository for specific details: https://github.com/andrew-locklair-fs/react-vite-compiler-repro

Screenshot demonstrating sourcemaps appropriately added with default config:

Image

Screenshot demonstrating sourcemaps not added when using the custom vite-plugin-babel:

Image

Happy to dig into this more, but hoping that it's as simple as just turning the relevant sourcemaps option ON for the custom Vite Babel plugin. I ran into this converting a RRv7 framework mode repo to add React Compiler, and the instructions seem to leave out sourceMaps: true in babelConfig.

贡献指南

打开贡献指南

从这里开始

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

调研方向

从 React Compiler 安装页面和链接的 react-vite-compiler-repro 仓库开始。检查自定义 Vite Babel 插件的设置及其 babelConfig,然后验证 sourceMaps: true 是否能解决报告的 sourcemap 差异;如果确认可以,再更新安装说明。

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

评估

技术栈
babel, javascript, react, vite
领域
documentation
Issue 类型
文档
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
48/100

把新 issue 发到你的邮箱

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