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

NextJS 14 forced to use swc and cannot switch to babel anymore. #57608

Closed
1 task done
BanDroid opened this issue Oct 27, 2023 · 30 comments
Closed
1 task done

NextJS 14 forced to use swc and cannot switch to babel anymore. #57608

BanDroid opened this issue Oct 27, 2023 · 30 comments
Labels
bug Issue was opened via the bug report template. create-next-app Related to our CLI tool for quickly starting a new Next.js application. locked SWC Related to minification/transpilation in Next.js.

Comments

@BanDroid
Copy link

BanDroid commented Oct 27, 2023

Link to the code that reproduces this issue

https://github.com/BanDroid/next-swc-android-issue

To Reproduce

  1. create-next-app in termux.
  2. run dev.
  3. create .babelrc/babel.config.js and use presets "next/babel".

Current vs. Expected behavior

SWC does support Android arm64, but somehow swc in nextjs cannot support it, i always switch to babel for workaround, but now i cant switch to use babel.

Verify canary release

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

Provide environment information

Operating System:
  Platform: android
  Arch: arm64
  Version: #1 SMP PREEMPT Fri Jul 29 23:55:04 CST 2022
Binaries:
  Node: 18.16.1
  npm: 9.5.1
  Yarn: 1.22.19
  pnpm: 8.8.0
Relevant Packages:
  next: 14.0.0
  eslint-config-next: 14.0.0
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A

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

CLI (create-next-app), Operating System (Windows, MacOS, Linux), Package manager (npm, pnpm, Yarn), SWC minifier (swcMinify: true), SWC transpilation

Additional context

fyi, i use termux to code. last version i tested fine was next 13.4

@BanDroid BanDroid added the bug Issue was opened via the bug report template. label Oct 27, 2023
@github-actions github-actions bot added create-next-app Related to our CLI tool for quickly starting a new Next.js application. area: OS SWC Related to minification/transpilation in Next.js. labels Oct 27, 2023
@BanDroid
Copy link
Author

fyi: i use pnpm, i also try with npm and yarn too, result was the same.

@kdy1 kdy1 self-assigned this Oct 27, 2023
@kdy1
Copy link
Member

kdy1 commented Oct 27, 2023

Is Disabled SWC as replacement for Babel because of custom Babel configuration printed?

@BanDroid
Copy link
Author

Is Disabled SWC as replacement for Babel because of custom Babel configuration printed?

no, that was the weird part, usually i see this

@kdy1
Copy link
Member

kdy1 commented Oct 27, 2023

Does it crash? Please post the whole error message

@BanDroid
Copy link
Author

Does it crash? Please post the whole error message

yes, it does crash.

> next-swc-android-issue@0.1.0 dev /data/data/com.termux/files/home/Projects/NextJS/
> next dev

   ▲ Next.js 14.0.0
   - Local:        http://localhost:3000

 ⚠ Trying to load next-swc for target triple [object Object], but this target is not supported
 ⨯ Failed to load SWC binary for android/arm64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc

@kdy1 kdy1 removed their assignment Oct 28, 2023
@jujutsucode
Copy link

i want to use android/arm64 too

@BanDroid
Copy link
Author

i want to use android/arm64 too

use Next v13 for now, we cant use v14 yet.

@tsanyqudsi
Copy link

I can reproduce this in termux.

@jridgewell
Copy link
Contributor

We've reintroduced WASM fallback for SWC (and enabled it by default in web containers).

@tsanyqudsi
Copy link

@jridgewell fix confirmed. 🚀 🎉

@jujutsucode
Copy link

Hoe to use that?

@tsanyqudsi
Copy link

@jujutsucode how to use what ?

@jujutsucode
Copy link

jujutsucode commented Nov 10, 2023 via email

@tsanyqudsi
Copy link

@jujutsucode can you clarify your question ? This issue is about NextJS 14 can't be installed in Termux because of SWC issues. Is that your issue as well ?

@BanDroid
Copy link
Author

BanDroid commented Nov 10, 2023

@jridgewell it still occuring in termux android, already have .babelrc with next/babel as presets, and also set swcMinify to false in next.config.js.

running dev server still trying to load swc binary.

here's new log

> test-2@0.1.0 dev /data/data/com.termux/files/home/Projects/NextJS/test-2                                                                 
> next dev
                                                                        
▲ Next.js 14.0.2                                                     
- Local:        http://localhost:12345
                                                                      
⚠ Disabling SWC Minifer will not be an option in the next major version. Please report any issues you may be experiencing to https://github.com/vercel/next.js/issues                                            
⚠ Attempted to load @next/swc-android-arm64, but it was not installed
⨯ Failed to load SWC binary for android/arm64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc

@jridgewell
Copy link
Contributor

Enable experimental: { useWasmBinary: true } in your next.config.js

@BanDroid
Copy link
Author

Enable experimental: { useWasmBinary: true } in your next.config.js

alright, will test it and send the result

@BanDroid
Copy link
Author

Enable experimental: { useWasmBinary: true } in your next.config.js

still crashing, now it even worse, no logs about the crash or error, just stopped immedietly.

~/.../NextJS/test-2 $ pnpm run dev

> test-2@0.1.0 dev /data/data/com.termux/files/home/Projects/NextJS/test-2                                                                  > next dev                                                            
   ▲ Next.js 14.0.2
   - Local:        http://localhost:3000

~/.../NextJS/test-2 $

@jridgewell
Copy link
Contributor

I'm afraid I don't have an Android device to debug this.

@jridgewell jridgewell reopened this Nov 14, 2023
@BanDroid
Copy link
Author

BanDroid commented Nov 14, 2023

I'm afraid I don't have an Android device to debug this.

do nextjs have log level for debugging crash? more verbose message would be needed.

could you use emulator and install termux so you could reproduce it?

@gorenganhunter
Copy link

I'm afraid I don't have an Android device to debug this.

do nextjs have log level for debugging crash? more verbose message would be needed.

could you use emulator and install termux so you could reproduce it?

I think its because the package version is stopped at 13
https://www.npmjs.com/package/@next/swc-android-arm64

@gorenganhunter
Copy link

I'm afraid I don't have an Android device to debug this.

do nextjs have log level for debugging crash? more verbose message would be needed.

could you use emulator and install termux so you could reproduce it?

This is the log at first npm run dev after create next app (sorry i cant upload image here)
https://raw.githubusercontent.com/GorenganHunter/static/main/Screenshot_20231117-092131_Termux.png

@Talent30
Copy link

Talent30 commented Nov 19, 2023

@jridgewell @next/swc-wasm-nodejs is not in sync with nextjs anymore, so we can't even run Next.js 14 in WebContainer

https://www.npmjs.com/package/@next/swc-wasm-nodejs

Enable experimental: { useWasmBinary: true } in your next.config.js

@zXpro27
Copy link

zXpro27 commented Nov 20, 2023

Enable experimental: { useWasmBinary: true } in your next.config.js

Not closed fakk!! Still error

@tsanyqudsi
Copy link

@jridgewell fix confirmed. 🚀 🎉

retracted.. it was a fluke 😢 sorry for the false confirmation

@loginVeb
Copy link

When the problem is fixed, I want to program in termux on nextjs 14 🥺

@BanDroid
Copy link
Author

BanDroid commented Dec 16, 2023

update: i successfully run next 14.0.4 in termux, the requirements are here:

  • proot (i tried with debian 10 buster from Andronix)
  • arm64 device
  • node >= v18.17

Screenshot_20231216-235613.png

i have verified my own solution, so if anyone got this working too, notified me so i could close the issue.

@Talent30
Copy link

update: i successfully run next 14.0.4 in termux, the requirements are here:

* proot (i tried with debian 10 buster from Andronix)

* arm64 device

* node >= v18.17

Screenshot_20231216-235613.png

i have verified my own solution, so if anyone got this working too, notified me so i could close the issue.

Yes it's fixed in bb25edf I think we can close this ticket now

@BanDroid
Copy link
Author

Yes it's fixed in bb25edf I think we can close this ticket now

it was not because it was fixed, i found a workaround to make this work. arm64 device would work like a charm, but it still doesn't work for any 32bit device or 32bit mode on 64bit (armv8l).

but yeah, i'll close this issue then.

Copy link
Contributor

github-actions bot commented Jan 1, 2024

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 Jan 1, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 1, 2024
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. create-next-app Related to our CLI tool for quickly starting a new Next.js application. locked SWC Related to minification/transpilation in Next.js.
Projects
None yet
Development

No branches or pull requests

9 participants