Skip to content

The swcPlugins are causing "tree shaking" to be ineffective, which seems like a bug. #52679

Closed
@coder-xiaotian

Description

@coder-xiaotian

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.5.0: Mon Apr 24 20:52:24 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T6000
    Binaries:
      Node: 16.16.0
      npm: 8.11.0
      Yarn: 1.22.15
      pnpm: 6.11.0
    Relevant Packages:
      next: 13.4.9
      eslint-config-next: 13.4.5
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.3
    Next.js Config:
      output: N/A

Which area(s) of Next.js are affected? (leave empty if unsure)

No response

Link to the code that reproduces this issue or a replay of the bug

https://github.com/coder-xiaotian/layzy-cut

To Reproduce

I used my custom swc plugin use-client in the lazy-cut project, When executing "pnpm analyze," it was found that all components of @mui/material are being bundled, but removing the "use-client" plugin resolves this issue.

Describe the Bug

With "use-client" enabled:
image

Without "use-client":
image

Expected Behavior

I sought help from the SWC community, and they mentioned that this appears to be a bug in Next.js.
image

Which browser are you using? (if relevant)

Chrome 114.0.5735.198

How are you deploying your application? (if relevant)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions