Skip to content

HMR didn't work for dynamic imported modules (React) #20

Closed
@Alex-Ferreli

Description

@Alex-Ferreli

Describe the bug

Plugin-react-refresh didn't refresh dynamic imported modules.

Reproduction

Repository to reproduce:
https://github.com/Alex-Ferreli/vite-react-hmr-dynamic-import

It's the default react-ts template with a dynamic import of a React component.

System Info

Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers:

System:
    OS: Linux 5.8 Ubuntu 20.04.2 LTS (Focal Fossa)
    CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
    Memory: 404.95 MB / 15.43 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 15.5.0 - ~/.nvm/versions/node/v15.5.0/bin/node
    Yarn: 1.22.5 - /usr/bin/yarn
    npm: 7.3.0 - ~/.nvm/versions/node/v15.5.0/bin/npm
  Browsers:
    Chrome: 89.0.4389.90
    Firefox: 86.0.1
  npmPackages:
    vite: ^2.1.3 => 2.1.3

Used package manager: yarn

Logs

The HMR in console print the parent file:
[vite] hot updated: /src/App.tsx

Before submitting the issue, please make sure you do the following

  • [ x] Read the Contributing Guidelines.
  • [ x] Read the docs.
  • [ x] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • [ x] Provide a description in this issue that describes the bug.
  • [ x] 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.
  • [ x] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feat: hmrp3-minor-bug 🔨An edge case that only affects very specific usage (priority)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions