-
Notifications
You must be signed in to change notification settings - Fork 27.3k
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
HMR with TypeScript causes infinite reloading loops #4285
Comments
I haven't checked but I can fix it here too: vercel/next-plugins#162 |
That won’t fix it I’m afraid, it should still have the same infinite loop behavior (the example repo is using babel7) |
@orta I didn't mean that it's already fixed there but that I could incorporate your fix into that PR 😃 (which would be the right place to fix it I think). |
Ah, yeah, good thinking 👍 |
@orta I can't seem to reproduce your issue though neither in Safari, Chrome, FF – so I'm not sure if a fix is needed 🤔. Your repro has one (unrelated) problem however: you shouldn't wrap the page in import Head from "next/head"
export default () => (
<div style={{ textAlign: "center", paddingTop: "90px", fontFamily: "Avenir Next" }}>
<Head>
<title>Hi!</title>
</Head>
<p>Hello there, please change this text</p>
</div>
) |
Ah dang, I committed the fix - wasn't meant to Master is reverted to having it commented out |
Yeah, I noticed 😃 but I don't get the infinite reload loop with or without your fix. |
I'm intermittently getting an infinite reload loop with the integration tests. I thought it was due to the changes in my PR at first, but checking out master, I can still reproduce. It makes me wonder if this reload loop even relates to TypeScript or if there's an issue with HMR overall. |
I've just given it a shot and I'm afraid I still get infinite loops, video: https://ortastuff.s3.amazonaws.com/vids/peril-next-canary.mov |
Same as @orta here and also typescript. But not stable. Refreshing sometimes helps. In my case this happens only in Safari. |
same here. |
Will probably be fixed by #4639 |
👋 Hey everyone, I've been using next with TypeScript (was 6.0 canary, now with 6.0.1 canary) and HMR has been causing quite a lot of issues. I created an example repo to showcase it: nextjs-typescript-hrm-bug-example
Basically the default setup for HRM in nextjs means that making a change in a
*.tsx
file would cause an infinite loop with these errorsWhich you need to kill the server to stop.
In making the example repo, I came up with the solution in my
next.config.js
:Which modifies the HMR to support TS.
Expected Behavior
This should probably be documented somewhere 👍 (which in part this issue is meant to do for others with the same problem)
Perhaps the with-typescript example could be updated to babel's TypeScript instead, and this can be added to the config file?
Steps to Reproduce (for bugs)
Then change
index.tsx
Context
n/a
The text was updated successfully, but these errors were encountered: