-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
Updating CSS Modules always triggers full reload #57046
Comments
It seems to work correctly if I downgrade the version of next.js to 13.2 |
Ideally, this should not happen in production because hot module reload works for the development environment. Can you give some insights here on this module-specific CSS files @balazsorban44
It would be really helpful. |
It may be related to my issue. Editing any tailwind class or editing the global.css causes a hard reload if a CSS file is imported into the layout.tsx. Edit: I have tested it with Next v 13.2, then it works. |
I have spent some time narrowing this issue down. Two things are needed for this to happen:
Example component where this happens: import Link from "next/link";
import styles from "./page.module.css";
export default function Home() {
return (
<div className={styles.container}>
<p>main page</p>
<Link href="/sub" />
</div>
);
} Editing Here is a minimal reproduction example: https://github.com/Celsiusss/next-css-reload-repro |
I've had this bug for months and I finally figured out what causes this!! but there's still no fix. It happens if you have a css module file in a server component. If you convert the component or page using the css module file to a client component with 'use client' and then go back to the module css file and save the smooth hot reload will work again. This is very frustrating because I have many server components that use css modules that I don't necessarily want to convert to client components. This bug really slows down productivity for those who use CSS modules with server components! |
This comment has been minimized.
This comment has been minimized.
Ran into the same issue. Image component from |
Same problem here on [email protected] Any changes inside a stylesheet module file (any.module.scss) will cause a page reload. |
Any updates from the team on this one? Been encountering the same issue here across multiple projects for quite a while now. It seems to be a pretty long-standing issue, and it's a serious productivity killer – especially on slower machines or when a route requires network calls each time it loads. |
Maybe it will be helpful for someone: renaming of any image (in /public) is helping to get HMR back (temporally) |
Hi everyone— I can confirm this is still an issue with Webpack HMR. Have you folks tried using Turbopack instead (highly recommend at this point as dev is passing all tests). With Turbopack ( |
This comment has been minimized.
This comment has been minimized.
--turbo worked for me. Will Turbopack eventually be rolled into the default |
Link to the code that reproduces this issue
https://github.com/vercel/next.js/tree/canary/packages/create-next-app
To Reproduce
npx create-next-app@latest
app/page.module.css
and it triggers full reload instead of fast refresh like thisCurrent vs. Expected behavior
It should trigger fast refresh when I edit css modules.
Actually, the following cases execute fast refresh correctly.
App Router
at the install.Verify canary release
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, CLI (create-next-app)
Additional context
No response
The text was updated successfully, but these errors were encountered: