vercel / next.js

The React Framework
https://nextjs.org
MIT License
127.09k stars 27.01k forks source link

SWCMinify breaks React Table, Terser works fine #44135

Closed OmerWow closed 1 year ago

OmerWow commented 1 year ago

Verify canary release

Provide environment information

Hi,

https://github.com/TanStack/table/issues/4610

Turns out SWCMinify may not be that stable after all, it completely breaks React Table and crashes production environments, and only disabling it to make Terser the default minifier solves the problem.

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

SWC minifier (swcMinify: true)

Link to the code that reproduces this issue

https://github.com/TanStack/table/issues/4610

To Reproduce

Just use the lastest 2 versions of React Table (maybe the filtering functionality should be enabled, I'm not sure) with Next.js 13. That's it, it should now break like discussed in the included link.

Describe the Bug

Seems like SWCMinify breaks something with React Table's code, while Terser does not.

Expected Behavior

SWC is considered stable and enabled by default in production, it should just work.

Which browser are you using? (if relevant)

N/A

How are you deploying your application? (if relevant)

Vercel, but shouldn't matter

danielbruni commented 1 year ago

I can confirm the same problem with bitmovin player package

OmerWow commented 1 year ago

So turns out Next.js 13.1.0 fixes the issue, which is great, but still raises the question: Should the SWC Minifier can be considered stable?

This bug broke a good number of production builds, with no way of even spotting the problem in development or during building. This can cause huge problems for companies and their customers, and even though this bug was fixed pretty quickly thanks to your amazing team, it still concerns me that it can happen again in the future.

I actually had a pretty bad experience using SWCMinify during it's development in the past year, and while I know it was considered in "experimental", "beta", "RC" etc., I had dozens of "production" (it was my stage env) bugs exactly like that one, with no way of spotting it during dev and building phases (never related to React Table BTW). Now, seeing this problem in actual production, something that almost ruined an important Zoom presentation since the production crashed with no fault of my own (I mean it passed all manual and automated tests, just pages with React Table crashed, and they were missed during the testing), is really concerning.

I really love and appreciate your work and I think Next.js is seriously amazing, but I'm going to leave SWCMinify disabled for now, and I really think this needs to go through more testing before more production environments will crash.

github-actions[bot] commented 1 year ago

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