Build Error when trying to compile with 'use client' files.
iliacodes opened this issue · 0 comments
Link to the code that reproduces this issue
https://github.com/iliacodes/test
To Reproduce
Run npx create-next-app@latest
Create a new component with simple text.
Run npm run dev
Change component by adding 'use client' to top of file.
Run npm run dev
Current vs. Expected behavior
Current behavior:
Build Error
Failed to compile
Next.js (14.2.3)
./src/components/Test.tsx
Module parse failed: Expecting Unicode escape sequence \uXXXX (2:55)
| import { createProxy } from "next/dist/build/webpack/loaders/next-flight-loader/module-proxy"
> const proxy = createProxy(String.raw`C:\Users\<user>\Desktop\RepGrp\test\src\components\Test.tsx`)
|
| // Accessing the __esModule property and exporting $$typeof are required here.
This error occurred during the build process and can only be dismissed by fixing the error._
Expected behavior:
To display text in component in expected area.
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Home
Available memory (MB): 16302
Available CPU cores: 16
Binaries:
Node: 20.12.2
npm: N/A
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 14.2.3 // Latest available version is detected (14.2.3).
eslint-config-next: 14.2.3
react: 18.3.1
react-dom: 18.3.1
typescript: 5.4.5
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
Module Resolution
Which stage(s) are affected? (Select all that apply)
next build (local), Vercel (Deployed)
Additional context
My username has backticks, haven't really had many issues previously. Figured that must be it. I created a new docker container and the code worked as expected.
After, I google'd and found a discussion previously addressing this issue in 2023
#47736
The issue seemed to have been closed when users updated to 13.3.1-canary.4 and only effected windows users.
Therefore, I tried this version and the 'use client' file worked as expected.