Skip to content

[RSC] The entire @mui/joy/node bundle is included in the client bundle when Joy UI component is being imported into a RSC #37934

Open
@mwskwong

Description

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example: https://github.com/mwskwong/mui-joy-nested-grid-in-server-component

Steps:

  1. Create a Next.js app router app
  2. Import any MUI Joy components in page.tsx, which is my default RSC.
  3. Build the project and observe the tree map of the client bundle. The entire @mui/joy/node will be included.

Current behavior 😯

The node bundle of @mui/joy is being bundled in the client bundle.

Expected behavior 🤔

The client-side bundle + tree-shaking should be used instead.

Context 🔦

Doesn't seem to affect functionality though. Just that the client bundle becomes massive.

Not sure if only Joy is affected. Or all MUI packages.

Your environment 🌎

npx @mui/envinfo
  System:
    OS: Windows 10 10.0.22621
  Binaries:
    Node: 18.16.1 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 9.5.1 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.22621.1928.0), Chromium (114.0.1823.58)
  npmPackages:
    @emotion/react: ^11.11.1 => 11.11.1
    @emotion/styled: ^11.11.0 => 11.11.0
    @mui/base:  5.0.0-beta.7
    @mui/core-downloads-tracker:  5.14.0
    @mui/joy: ^5.0.0-alpha.87 => 5.0.0-alpha.87
    @mui/private-theming:  5.13.7
    @mui/styled-engine:  5.13.2
    @mui/system:  5.14.0
    @mui/types:  7.2.4
    @mui/utils:  5.13.7
    @types/react: 18.2.14 => 18.2.14
    react: 18.2.0 => 18.2.0
    react-dom: 18.2.0 => 18.2.0
    typescript: 5.1.6 => 5.1.6

Metadata

Assignees

Projects

  • Status

    Selected

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions