vercel / next.js

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

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

Closed BanDroid closed 9 months ago

BanDroid commented 11 months ago

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

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 commented 11 months ago

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

kdy1 commented 11 months ago

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

BanDroid commented 11 months ago

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

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

kdy1 commented 11 months ago

Does it crash? Please post the whole error message

BanDroid commented 11 months ago

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
jujutsucode commented 11 months ago

i want to use android/arm64 too

BanDroid commented 11 months ago

i want to use android/arm64 too

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

tsanyqudsi commented 11 months ago

I can reproduce this in termux.

jridgewell commented 10 months ago

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

tsanyqudsi commented 10 months ago

@jridgewell fix confirmed. 🚀 🎉

jujutsucode commented 10 months ago

Hoe to use that?

tsanyqudsi commented 10 months ago

@jujutsucode how to use what ?

jujutsucode commented 10 months ago

The wasm

Pada Jum, 10 Nov 2023 11.09, Muhammad Tsany Qudsi @.***> menulis:

@jujutsucode https://github.com/jujutsucode how to use what ?

— Reply to this email directly, view it on GitHub https://github.com/vercel/next.js/issues/57608#issuecomment-1805056260, or unsubscribe https://github.com/notifications/unsubscribe-auth/BA6IEYQLQABKQQ24FCNPY4LYDWSGNAVCNFSM6AAAAAA6S6VVI6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBVGA2TMMRWGA . You are receiving this because you were mentioned.Message ID: <vercel/next .@.***>

tsanyqudsi commented 10 months ago

@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 commented 10 months ago

@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 commented 10 months ago

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

BanDroid commented 10 months ago

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

alright, will test it and send the result

BanDroid commented 10 months ago

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 commented 10 months ago

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

BanDroid commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

@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 commented 10 months ago

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

Not closed fakk!! Still error

tsanyqudsi commented 10 months ago

@jridgewell fix confirmed. 🚀 🎉

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

loginVeb commented 10 months ago

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

BanDroid commented 9 months ago

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

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 commented 9 months ago

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 https://github.com/vercel/next.js/commit/bb25edfdd4964994176085f26a9f38434ad66b58 I think we can close this ticket now

BanDroid commented 9 months ago

Yes it's fixed in https://github.com/vercel/next.js/commit/bb25edfdd4964994176085f26a9f38434ad66b58 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.

github-actions[bot] commented 9 months ago

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.