You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
Thanks for the repro. This is triggered by having circular references in your imports, and probably having the entrypoint be part of the cycle doesn't help. Probably this regression should be fixable, but my advice is too avoid circular imports, it makes HMR a lot more predictable.
I think this is related to #19601 which fixed other issue #19135. Cyclic imports (especially involving main entry /src/main.tsx) is fairly tricky and I would imagine that's already broken in some ways.
Supporting this case might be out of scope and, like Arnaud said, we recommend to avoid exporting anything from main.tsx.
Now your app and dev server is broken and you need to kill and restart it to make the app working again.
Hmm, I missed this one and it looks like this reproduces only with custom base. Without base, html script gets replaced with ?t=..., but with base, it's stripped off and that's causing two modules /app/src/main.tsx and /app/src/main.tsx?t=... to exist after reload.
// without base
<scripttype="module" src="/src/main.tsx?t=1742782690504"></script>
// with base
<scripttype="module" src="/app/src/main.tsx"></script>
Activity
ArnaudBarre commentedon Mar 20, 2025
Thanks for the repro. This is triggered by having circular references in your imports, and probably having the entrypoint be part of the cycle doesn't help. Probably this regression should be fixable, but my advice is too avoid circular imports, it makes HMR a lot more predictable.
hi-ogawa commentedon Mar 21, 2025
I think this is related to #19601 which fixed other issue #19135. Cyclic imports (especially involving main entry
/src/main.tsx) is fairly tricky and I would imagine that's already broken in some ways.Supporting this case might be out of scope and, like Arnaud said, we recommend to avoid exporting anything from
main.tsx.hi-ogawa commentedon Mar 24, 2025
Hmm, I missed this one and it looks like this reproduces only with custom
base. Without base, html script gets replaced with?t=..., but with base, it's stripped off and that's causing two modules/app/src/main.tsxand/app/src/main.tsx?t=...to exist after reload.The working version without base https://stackblitz.com/edit/github-wn1mrcdz?file=vite.config.ts