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

next > 13.4.10 too aggressive tree shaking #53286

Closed
1 task done
Torsten85 opened this issue Jul 28, 2023 · 6 comments · Fixed by #53308 or #53416
Closed
1 task done

next > 13.4.10 too aggressive tree shaking #53286

Torsten85 opened this issue Jul 28, 2023 · 6 comments · Fixed by #53308 or #53416
Assignees
Labels
bug Issue was opened via the bug report template. locked

Comments

@Torsten85
Copy link

Torsten85 commented Jul 28, 2023

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: Thu Jun  8 22:22:20 PDT 2023; root:xnu-8796.121.3~7/RELEASE_ARM64_T6000
    Binaries:
      Node: 19.6.0
      npm: 9.4.0
      Yarn: N/A
      pnpm: 8.5.0
    Relevant Packages:
      next: 13.4.9
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0
      typescript: N/A
    Next.js Config:
      output: N/A

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

webpack optimization I guess

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

https://github.com/Torsten85/next-13-4-10-tree-shaking-bug

To Reproduce

run pnpm i && pnpm test, see the error (13.4.13-canary.5)
run git checkout downgrade && pnpm i && pnpm test, see no error (13.4.9)

Describe the Bug

SWC minify removes a used chunk of code from a dependency, resulting in a production error

Expected Behavior

the bundling process should correctly determine that the code block is referenced and in use

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

@Torsten85 Torsten85 added the bug Issue was opened via the bug report template. label Jul 28, 2023
@icyJoseph
Copy link
Contributor

@Torsten85
Copy link
Author

Seems like it, but I get the same result with swcMinify: false

@icyJoseph
Copy link
Contributor

Really? There was a repository on one of those issues, and it worked with minify turned off. Mmm 🤔 yours uses app router, wonder if that changes things. Could you try with pages router?

@Torsten85
Copy link
Author

Sorry, I was wrong, swcMinify: false did prevent the error.

@kdy1 kdy1 self-assigned this Jul 28, 2023
@kdy1
Copy link
Member

kdy1 commented Jul 28, 2023

This will be fixed by swc-project/swc#7702

@kodiakhq kodiakhq bot closed this as completed in #53308 Jul 29, 2023
kodiakhq bot pushed a commit that referenced this issue Jul 29, 2023
### What?

Update `swc_core` to swc-project/swc@00a0575

### Why?

To fix minifier regression.

### How?

 - Closes WEB-1326
 - Fixes #53151
 - Fixes #53286
 - Fixes #53273
@kdy1 kdy1 reopened this Aug 2, 2023
@kodiakhq kodiakhq bot closed this as completed in #53416 Aug 2, 2023
kodiakhq bot pushed a commit that referenced this issue Aug 2, 2023
### What?

Update `swc_core` to swc-project/swc@383509f

### Why?

To fix minifier regression.

### How?

 - Closes WEB-1326
 - Fixes #53151
 - Fixes #53286
 - Fixes #53273
@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 17, 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

Successfully merging a pull request may close this issue.

3 participants