Skip to content

feat: upgrade to React 19, remove Rax compat layer#7169

Open
FuzzyFade wants to merge 20 commits intomasterfrom
feat/react-19-upgrade
Open

feat: upgrade to React 19, remove Rax compat layer#7169
FuzzyFade wants to merge 20 commits intomasterfrom
feat/react-19-upgrade

Conversation

@FuzzyFade
Copy link
Collaborator

ice.js v4: React 19 升级 + 移除 Rax 兼容层

变更概览

依赖升级

  • react/react-dom → ^19.0.0(根 + 所有 packages)
  • @types/react, @types/react-dom → ^19.0.0
  • peerDependencies 保持双版本兼容:^18.0.0 || ^19.0.0
  • @ice/jsx-runtime peer → ^16 || ^17 || ^18 || ^19

移除 Rax

  • 删除 packages/rax-compat/
  • 删除 packages/plugin-rax-compat/
  • 删除 examples/rax-inline-style/, examples/rax-project/
  • 移除 rax 相关文档

React 19 适配标注

  • 标注 forwardRef 使用处(React 19 已废弃,可改用 ref-as-prop)
  • 标注 Context.Provider 使用处(React 19 可简化为直接使用 Context)

迁移文档

  • 新增 website/docs/guide/advanced/update-from-icejs3.md

未包含(后续 PR)

  • react-router-dom v6 → v7 升级
  • react-reconciler 升级(小程序运行时)
  • forwardRef 实际重构

测试

  • CSR 应用
  • SSR 应用
  • SSG 应用
  • 小程序
  • icestark 微前端

138 files changed, 1456 additions, 4868 deletions

- Upgrade react/react-dom to ^19.0.0 in root and all packages
- Update @types/react and @types/react-dom to ^19.0.0
- Set peerDependencies to '^18.0.0 || ^19.0.0' for dual-version compat
- Update @ice/jsx-runtime peer to '^16 || ^17 || ^18 || ^19'
- Remove packages/rax-compat and packages/plugin-rax-compat
- Remove examples/rax-inline-style and examples/rax-project
- Remove rax-related documentation
- Add TODO comments for forwardRef (React 19 deprecation)
- Add TODO comments for Context.Provider (React 19 simplification)
- Add migration guide: update-from-icejs3.md
- Keep react-router-dom and react-reconciler versions unchanged
- Keep react-refresh at 0.14.0 (already React 19 compatible)
…xamples

- Remove @ice/plugin-rax-compat from basic-project, disable-data-loader, multi-target examples
- Regenerate pnpm-lock.yaml to match updated package.json versions
- Add pnpm.overrides to force @types/react@^19 across all packages
  (prevents dual @types/react@18 + @types/react@19 in node_modules)
- Upgrade react-router-dom 6.21.3 → 6.30.3 (React 19 type compat)
- Upgrade @remix-run/router 1.14.2 → 1.23.2 (required by react-router-dom 6.30.3)
- Regenerate pnpm-lock.yaml
@CLAassistant
Copy link

CLAassistant commented Mar 6, 2026

CLA assistant check
All committers have signed the CLA.

@FuzzyFade FuzzyFade force-pushed the feat/react-19-upgrade branch from f8ee55c to a55616b Compare March 6, 2026 13:07
…bility

- React 19 no longer provides global JSX namespace
- Use React.ReactElement instead of JSX.Element for type definitions
- Affects: MetaType, TitleType, LinksType, ScriptsType, DataType, FirstChunkCacheType, MainType
- React 19 requires useRef to be called with an initial value
- Fixes TS2554: Expected 1 arguments, but got 0
@FuzzyFade FuzzyFade force-pushed the feat/react-19-upgrade branch from a55616b to 4bc08f3 Compare March 6, 2026 13:09
FuzzyFade added 15 commits March 6, 2026 22:07
- Multiple React versions (18.2.0 and 19.x) caused 'Invalid hook call' errors
- Added overrides for react, react-dom, @types/react, @types/react-dom to ^19.0.0
- This ensures all dependencies use React 19
- React 19 upgrade resolved the type issues
- Removed ts-expect-error comments in:
  - packages/ice/src/bundler/webpack/start.ts
  - packages/ice/src/webpack/ServerCompilerPlugin.ts
- tsx 3.x uses deprecated --loader flag
- tsx 4.x uses --import flag which is compatible with Node.js 20.6.0+
- Fixes CI build error on newer Node.js versions
The pnpm-lock.yaml uses lockfileVersion 9.0 which requires pnpm 9.x.
Using pnpm@8.9.2 caused 'Ignoring not compatible lockfile' warning
and led to dependency version conflicts.
dts-bundle contains both .ts and .js files. tsx loads .ts files,
where 'import * as assert from assert' makes assert an object
instead of a function. This patch removes the .ts files.
- RawCopyGlobOptions interface uses 'ignore' not 'gitignore'
- pnpm 9.x requires Node 18+, remove Node 16 from CI matrix
- Add type assertion for devServer property on Configuration
- Remove return value from tapPromise callback to match void return type
- Update react-reconciler from 0.27.0 to 0.33.0
- Update scheduler from 0.20.1 to 0.25.0
- React 19 requires newer react-reconciler version
- Add resolveUpdatePriority, setCurrentUpdatePriority, getCurrentUpdatePriority
- Add shouldAttemptEagerTransition
- These APIs are required by react-reconciler 0.33.0 for React 19
- Delete rax-inline-style.test.ts and rax-project.test.ts
- Add resolveEventTimeStamp, resolveEventType, trackSchedulerEvent APIs
- These APIs are required by react-reconciler 0.33.0 for React 19
- Add missing host config methods for react-reconciler 0.33.0
- Fix createContainer API with new required parameters (error handlers)
- Use updateContainerSync + flushSyncWork for synchronous rendering
- Fix commitUpdate parameter order
- Add hideTextInstance, unhideTextInstance, resetTextContent
- Add maySuspendCommit, preloadInstance, startSuspendingCommit
- Add NotPendingTransition, HostTransitionContext, resetFormInstance
- Add bindToConsole, scheduleMicrotask

This fixes most of the miniapp-react-dom tests for React 19.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants