vercel / next.js

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

[SWC] Code minification occurs with errors #43324

Closed archual closed 1 year ago

archual commented 1 year ago

Verify canary release

Provide environment information

Node: 16.17.0 npm: N/A Yarn: N/A pnpm: N/A Relevant packages: next: 12.3.1 eslint-config-next: N/A react: 18.2.0 react-dom: 18.2.0

What browser are you using? (if relevant)

107.0.5304.107

How are you deploying your application? (if relevant)

next start

Describe the Bug

We use next,js with blueprint.js (versions 12.3.1 and 3.54.0). In numeric field from blueprint in production version (minified by swc option in next config) buttons up and down stop working and cleare field value.

Code minification occurs with errors. The order of definition and initialization of variables is violated, because of which an uninitialized variable is involved in mathematical calculations, which leads to errors in calculating and obtaining the value NaN.

n.roundAndClampValue = function(t, n, o, r, a, i) { if (void 0 === a && (a = 0), c = t, l = i, s = eC(c, l), !(null != c && s - parseFloat(s) + 1 >= 0)) return e.VALUE_EMPTY; var c, l, s, u, p, h, d, f, v, m = eC(t, i), y = (d = Math.round((u = Number(m) + a) * h) / (h = Math.pow(10, n)), t7(d, null != o ? o : -1 / 0, null != r ? r : 1 / 0)); return eN(y, i) }

Here: var c, l, s, u, p, h, d, f, v, m = eC(t, i), y = (d = Math.round((u = Number(m) + a) * h) / (h = Math.pow(10, n))

I created demonstration repo: https://github.com/archual/next12_swc_minify_issue

Everything works correctly in Next 13, but we can't switch to Next 13 yet, due to the need to support IE.

Expected Behavior

The build and minification of the code are working correctly, the functionality of third-party libraries works correctly.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/archual/next12_swc_minify_issue

To Reproduce

run yand build &&& yarn start

go to the localhost:3000/test

Try to use number filed with arrows (up/down), value in field is cleared.

balazsorban44 commented 1 year ago

Closing as discussed via email, cannot reproduce in canary

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.