next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Styles broken if using a src directory in v13

Open n8sabes opened this issue 1 year ago • 3 comments

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

n8sabes avatar Oct 28 '22 19:10 n8sabes

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).

brvnonascimento avatar Oct 28 '22 19:10 brvnonascimento

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.

tonypeng avatar Oct 28 '22 22:10 tonypeng

@balazsorban44, Is there an easy way to use the canary branch that has this fix via pnpm add _____? Or, what are the steps?

n8sabes avatar Oct 31 '22 15:10 n8sabes

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 avatar Nov 01 '22 13:11 timneutkens

@timneutkens, Indeed that seems to have fixed the issue. It builds and styles are back. Closing issue.

Thank you!

😀

n8sabes avatar Nov 02 '22 05:11 n8sabes

Thanks for checking!

timneutkens avatar Nov 04 '22 14:11 timneutkens