[appDir] Next.js appDir can not resolve virtual CSS files injected by webpack-virtual-modules
#44266
Open
1 task done
Labels
bug
Issue was opened via the bug report template.
Verify canary release
Provide environment information
Which area(s) of Next.js are affected? (leave empty if unsure)
App directory (appDir: true)
Link to the code that reproduces this issue
https://github.com/SukkaW/nextjs-issue-virtual-css
To Reproduce
git clone https://github.com/SukkaW/nextjs-issue-virtual-css cd nextjs-issue-virtual-css npm run dev
Open
https://localhost:3001
Describe the Bug
Next.js' fails to collect CSS injected by
webpack-virtual-modules
fromappDir
, resulting in aModule not found
error:https://github.com/SukkaW/nextjs-issue-virtual-css/blob/a191e1cc9a0afcae2331b691dd6b11066940679a/next.config.js
I am porting a CSS-in-JS Next.js plugin to Next.js appDir (johanholmerin/style9#83). And it is common for CSS-in-JS to utilize
webpack-virtual-modules
to emit virtual CSS files (E.g. WindiCSS).However, Next.js 13 can not collect virtual CSS from
appDir
. Which would break all existing AoT CSS-in-JS plugins. And I have created a minimal re-production above.cc @shuding
Expected Behavior
The emitted virtual CSS files should be collected and resolved, just like the
pages
dir.Which browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
The text was updated successfully, but these errors were encountered: