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

`react-dom/server` cannot be resolved with `unstable_enablePackageExports` and condition `browser`

未关闭
#1,135 6 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
javascript
领域
tooling

调研方向

首先使用 unstable_enablePackageExports 和所示的 browser 条件重现 react-dom/server 的解析。检查 package.json 中的 exports 和 browser 映射,包括 server.browser.js;当 Metro 在没有回退警告的情况下解析该导入时,即完成。

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

描述

(As reported by @EvanBacon)

Metro cannot resolve react-dom/server with unable_enablePackageExports (and condition browser?), reporting:

warning: Attempted to import the module "/Users/evanbacon/Documents/GitHub/expo/node_modules/react-dom/server.browser.js" which is not listed in the "exports" of "/Users/evanbacon/Documents/GitHub/expo/node_modules/react-dom". Falling back to file-based resolution. Consider updating the call site or asking the package maintainer(s) to expose this API.

Conditions

  unstable_conditionNames: [ 'node', 'require' ],
  unstable_conditionsByPlatform: { web: [ 'browser' ] },

package.json

  "exports": {
    ".": "./index.js",
    "./client": "./client.js",
    "./server": {
      "deno": "./server.browser.js",
      "worker": "./server.browser.js",
      "browser": "./server.browser.js",
      "default": "./server.node.js"
    },
    "./server.browser": "./server.browser.js",
    "./server.node": "./server.node.js",
    "./profiling": "./profiling.js",
    "./test-utils": "./test-utils.js",
    "./package.json": "./package.json"
  },
  "browser": {
    "./server.js": "./server.browser.js"
  },
主要语言
JavaScript
星标
5.7k
派生
706
平均合并
2 天 4 小时
30 天内合并 PR
65

环境准备

从这里开始

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

react/metro 的其他 Issue

查看 react/metro 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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