next.js
next.js copied to clipboard
Styles broken if using a src directory in v13
Verify canary release
- [X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
Minimal example template using src
directory.
pnpm create create-next-app@latest --experimental-app
What browser are you using? (if relevant)
chrome
How are you deploying your application? (if relevant)
No response
Describe the Bug
Styles do not work if using a src
directory.
Expected Behavior
Styles should work.
Link to reproduction
See how to reproduce field
To Reproduce
pnpm create create-next-app@latest --experimental-app
cd [project_dir]
pnpm dev
View in browser --> works fine.
Move source into src
directory:
mkdir src
mv app src
mv pages src
pnpm dev
View in browser --> STYLES DO NOT WORK
Also noticed that, even by moving things out of the src
folder, Fast Refresh works for when adding or updating CSS properties but not when removing (needing a full page refresh to work).
my guess is the union of this issue and #41791 were causing the behavior I described in https://github.com/vercel/next.js/issues/41791#issuecomment-1294240622 (i.e. CSS modules broken in both server and client components), as I had also moved app into a src folder.
@balazsorban44, Is there an easy way to use the canary branch that has this fix via pnpm add _____
? Or, what are the steps?
pnpm add next@canary
works. That PR is out now on 13.0.1
though!
Can you let me know if your issue is solved by upgrading to 13.0.1?
@timneutkens, Indeed that seems to have fixed the issue. It builds and styles are back. Closing issue.
Thank you!
😀
Thanks for checking!