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

Build breaking when importing JSBI in 13.5.4 #56550

Closed
1 task done
jeremypress opened this issue Oct 7, 2023 · 5 comments · Fixed by #56770
Closed
1 task done

Build breaking when importing JSBI in 13.5.4 #56550

jeremypress opened this issue Oct 7, 2023 · 5 comments · Fixed by #56770
Assignees
Labels
bug Issue was opened via the bug report template. linear: turbopack Confirmed issue that is tracked by the Turbopack team. locked SWC Related to minification/transpilation in Next.js.

Comments

@jeremypress
Copy link

jeremypress commented Oct 7, 2023

Link to the code that reproduces this issue

https://github.com/jeremypress/next-issue-repro

To Reproduce

  1. run the application (this runs a built version of the app) https://replit.com/@jeremy/next-1354
  2. notice the client side error
  3. run the app on 13.5.3 https://replit.com/@jeremy/next-1353
  4. notice no errors

Relevant code:

import '../styles/globals.css'
import type { AppProps } from 'next/app'
import JSBI from 'jsbi';
const modulePath = require.resolve('jsbi');
console.log(modulePath);


function MyApp({ Component, pageProps }: AppProps) {
  const x: JSBI = JSBI.BigInt(Math.floor(Math.random() * 10000));
  console.log(x);
  return <Component {...pageProps} />
}

export default MyApp

This package is linking to UMD via the "browser" entry, which isn't great, but something changed behavior wise between next 13.5.3 and next 13.5.4

Current vs. Expected behavior

Following reproduction steps,
I did not expect this type error

TypeError: Cannot call a class as a function

Verify canary release

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

Provide environment information

Node 18, mac/linux, default next.config.js

Which area(s) are affected? (Select all that apply)

SWC transpilation

Additional context

I tried to original submit this with a repl, which I think should be a valid way to submit bugs 🤷🏻

WEB-1742

@jeremypress jeremypress added the bug Issue was opened via the bug report template. label Oct 7, 2023
@github-actions github-actions bot added the SWC Related to minification/transpilation in Next.js. label Oct 7, 2023
@adri1wald
Copy link

adri1wald commented Oct 7, 2023

I was going to create a separate issue for this but seems we're having the same problem. Attaching my repro here:

https://github.com/adri1wald/exceljs-repro

@balazsorban44 balazsorban44 added the linear: turbopack Confirmed issue that is tracked by the Turbopack team. label Oct 9, 2023
@kdy1 kdy1 self-assigned this Oct 9, 2023
@kdy1
Copy link
Member

kdy1 commented Oct 10, 2023

This is a regression between swc_core@v0.83.12 and swc_core@v0.83.28

next.js/Cargo.lock

Lines 6661 to 6663 in 76e06d5

[[package]]
name = "swc_core"
version = "0.83.12"

next.js/Cargo.lock

Lines 5811 to 5813 in 1e8dca4

[[package]]
name = "swc_core"
version = "0.83.28"


Range: swc-project/swc@e67bf05...83f77dd

@jeremypress
Copy link
Author

Thanks for the quick look @kdy1

@kdy1
Copy link
Member

kdy1 commented Oct 11, 2023

The cause was a bug related to the new mangling option. I'll fix it soon and will send a PR, hopefully today.

The new mangling option was added in #56281 to align with terser

kdy1 added a commit to swc-project/swc that referenced this issue Oct 12, 2023
sokra added a commit that referenced this issue Oct 17, 2023
### What?

Update SWC crates, to apply bugfixes.

### Why?

We adjusted the mangling option to make it identical with `swcMinify:
false` with #56281, and it
revealed some bugs of the name mangler of the SWC minifier.

### How?


 - Fixes #56550
 - Fixes #56614

 - Turbopack counterpart: vercel/turborepo#6171

### Other Turbopack Changes

* vercel/turborepo#6177 <!-- Tim Neutkens - Add
support for FreeVarReference::Error -->
* vercel/turborepo#6180 <!-- Tobias Koppers - fix
chunk loading in build runtime -->
* vercel/turborepo#6191 <!-- Justin Ridgewell -
Deduplicate referenced_output_assets -->
* vercel/turborepo#6171 <!-- Donny/강동윤 - build:
Update `swc_core` to `v0.86.1` -->

Closes WEB-1775

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Copy link
Contributor

github-actions bot commented Nov 1, 2023

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 added the locked label Nov 1, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 1, 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. linear: turbopack Confirmed issue that is tracked by the Turbopack team. locked SWC Related to minification/transpilation in Next.js.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants