-
-
Notifications
You must be signed in to change notification settings - Fork 8k
HMR error: Cannot access '...' before initialization #3033
Copy link
Copy link
Labels
Description
Describe the bug
The error happens when I try to edit component, that
- Wrap in
connectfunction (redux) - Is inside dependency loop
- There is another component inside dependency loop
Seems weird, but it's not so rare case when project uses routers like UiRouter or Universal router
I expect that component will be updated with HMR without errors or may be reload the page but not to throw an error
Reproduction
To reproduce this error you need to open the project and try to edit Component.tsx. You will see an error

System Info
Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:
System:
OS: Windows 10 10.0.19042
CPU: (6) x64 Intel(R) Core(TM) i5-8600K CPU @ 3.60GHz
Memory: 8.19 GB / 15.94 GB
Binaries:
Node: 14.15.3 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 6.14.9 - C:\Program Files\nodejs\npm.CMD
Browsers:
Edge: Spartan (44.19041.423.0), Chromium (89.0.774.77)
Internet Explorer: 11.0.19041.1
npmPackages:
vite: ^2.1.5 => 2.1.5Used package manager:
Logs
Before submitting the issue, please make sure you do the following
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Provide a description in this issue that describes the bug.
- 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 https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
Reactions are currently unavailable