-
Notifications
You must be signed in to change notification settings - Fork 27.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom page extensions (e.g. page.page.tsx) do not import CSS in AppDir #46702
Comments
i am encountering the same issue. any updates on this? |
Also seeing this. I'd like to migrate parts of the pages over to the app dir, disabling the |
Can confirm this is still the case in |
Seems like this is fixed in either 13.4.3 or 13.4.4. Did a quick test now on 13.4.4. 😅 |
Correction, seems like tailwind and global CSS works, but not css-modules. |
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://stackblitz.com/edit/vercel-next-js-bxppz3
To Reproduce
In
next.config.js
, add a custom extension that looks like this:pageExtensions: ['customextension.tsx', 'customextension.ts'],
This works with any extension of this format, but the version recommended in the stable NextJS docs recommend
page.tsx
: https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directoryCreate a page in
/app
. Import any.css
file. See how it does not get imported into the page.In the reproduction I have given,
/app/page.tsx
works when there is no custom extension, and/app/page.customextension.tsx
does not import the CSS.Describe the Bug
When not using custom page extensions, pages correctly import CSS:
When using a custom page extension, the CSS appears to be dropped completely:
I have a legacy NextJS application that relies on a custom extension of
page.tsx
to allow me to colocate components and other files in the/pages
directory, as recommended in the docs.Due to the size of the project, it is not feasible to migrate to
/app
or move all the components out of/pages
quickly (though it is a long-term goal)(Side note, the NextJS Typescript plugin also does not understanding custom page extensions - I intend to open a separate issue for that.)
Expected Behavior
CSS should import on files with custom page extensions, like
mypage.page.tsx
.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: