Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Enable @univerjs/core usage on Node servers without React dependency #4565

Open
2 tasks done
nahooni0511 opened this issue Jan 24, 2025 · 1 comment
Open
2 tasks done
Assignees

Comments

@nahooni0511
Copy link

Initial checklist

  • Is this really a problem?
  • I have searched the Github Issues for similar issues, but did not find anything.

Problem

According to the Univer documentation, it should be possible to use Univer on a Node server. However, in the current setup, we are forced to install react for server-side usage of @univerjs/core, which is inefficient and unnecessary for a server environment.

Inside the @univerjs/core package, there is an export statement referencing React bindings:

export * from '@wendellhu/redi/react-bindings';

Since @wendellhu/redi/react-bindings depends on react, this enforces a React dependency in @univerjs/core. It would be more efficient if @univerjs/core only declared @wendellhu/redi (without the react-bindings), and then @univerjs/ui (or a similar UI-focused package) could include @wendellhu/redi/react-bindings. That way, developers who only need server-side functionality wouldn’t be forced to install react in their Node environments.

Proposed Solution:

Remove the react-bindings export from @univerjs/core.
Declare and use @wendellhu/redi/react-bindings within @univerjs/ui (or a dedicated UI/module package) so that only UI/React-related features depend on react.
This separation would allow @univerjs/core to be used in Node/server projects without requiring a React installation, improving efficiency for back-end use cases.
Thank you for your consideration, and please let me know if you need further details or clarifications.

@jikkai jikkai self-assigned this Jan 24, 2025
@jikkai
Copy link
Member

jikkai commented Jan 24, 2025

We have recently become aware of this issue, and your suggestion aligns perfectly with one of the solutions we are currently considering. Implementing this change could introduce some breaking changes, so we are actively evaluating the potential impact. Once the plan is finalized, we will move forward with its implementation promptly. Thank you for your valuable suggestion!

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

No branches or pull requests

2 participants