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

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

Closed
1 task done
coder-xiaotian opened this issue Jul 14, 2023 · 2 comments
Closed
1 task done
Labels
bug Issue was opened via the bug report template. locked

Comments

@coder-xiaotian
Copy link

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

@coder-xiaotian coder-xiaotian added the bug Issue was opened via the bug report template. label Jul 14, 2023
@shuding
Copy link
Member

shuding commented Jul 15, 2023

This is expected at the moment. Exports crossed the first client boundary can't be free-shaken. We will look into improving it in the future.

@github-actions
Copy link
Contributor

This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template. locked
Projects
None yet
Development

No branches or pull requests

2 participants
  NODES
COMMUNITY 3
Project 4
USERS 1
Verify 1