Next.js: Styles not loading after navigation with mixed pages/app
Describe the bug
This is a continuation of #1152 with a new reproduction.
Having a project half migrated to the app directory breaks the CSS in the pages in /pages.
The code that fixes the CSS loading in pages only checks that the app directory is created, not that it's in use for that specific page.
How to reproduce
- Open reproduction
- Navigate from
pages: hometopages: other. CSS ofpages: otheris not loaded - Refresh the page. CSS is now loaded
- Navigate to
pages: home. CSS ofpages: homeis not loaded now - Navigating from/to the app directory routes works.
Reproduction
https://stackblitz.com/edit/stackblitz-starters-xzcmes
System Info
System:
OS: macOS 14.2.1
CPU: (10) arm64 Apple M1 Max
Memory: 542.77 MB / 32.00 GB
Shell: 3.7.0 - /opt/homebrew/bin/fish
Binaries:
Node: 18.19.1 - ~/Library/Caches/fnm_multishells/34040_1712568811215/bin/node
npm: 10.2.4 - ~/Library/Caches/fnm_multishells/34040_1712568811215/bin/npm
pnpm: 8.15.6 - ~/Library/Caches/fnm_multishells/34040_1712568811215/bin/pnpm
bun: 1.0.33 - ~/.bun/bin/bun
Browsers:
Chrome: 123.0.6312.107
Safari: 17.2.1
npmPackages:
@vanilla-extract/css: 1.14.2 => 1.14.2
@vanilla-extract/dynamic: 2.1.0 => 2.1.0
@vanilla-extract/next-plugin: 2.4.0 => 2.4.0
@vanilla-extract/vite-plugin: ^3.9.2 => 3.9.5
vite: ^5.1.3 => 5.1.4
webpack: ^5.88.2 => 5.90.0
Used Package Manager
pnpm
Logs
No response
Validations
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] The provided reproduction is a minimal reproducible example of the bug.
Same issue, confirmed https://github.com/vanilla-extract-css/vanilla-extract/issues/1152 doesn't fix
"next": "^14.0.4"
"@vanilla-extract/css": "^1.15.1"
"@vanilla-extract/next-plugin": "^2.4.0"
Note that this issue doesn't appear with css module: https://stackblitz.com/edit/stackblitz-starters-2ebzry
So it's seems to be related to vanilla extract
This issue seems related to this one https://github.com/vercel/next.js/issues/53858