Skip to content

self accepting HMR modules should not invalidate the whole import chain (?) #3719

@AlexandreBonaventure

Description

@AlexandreBonaventure

Describe the bug

We unravelled a bug recently in our application with HMR. When we change a single .vue file it throws an error like this one:
Screen Shot 2021-06-08 at 6 25 48 PM

This sounds like a circular dependency bug so we started trying to find it... but after some investigation we noticed this error message only shows up in vite@2.0.0-beta.34 and later.
This commit is the one we are looking at:
ca8442c

Here's are two videos:

  1. showing what's happening on 2.0.0-beta.33: everything works correctly, the change is update live and does not throw any error
    https://user-images.githubusercontent.com/4596409/121266195-12b6a800-c888-11eb-9724-20c996aa8e12.mov

  2. showing what's happening on 2.0.0-beta.34: here the whole importer chain is invalidated.
    https://user-images.githubusercontent.com/4596409/121266365-63c69c00-c888-11eb-8c4d-c35fda601514.mov

Not only it throws an error, but it seems inefficient to invalidate the whole chain just to propagate one change on a component.

We didn't notice the bug until today despite running latest vite (2.3.6) because the error is thrown only on this component. I guess because it has a specific set of importers/deps that are not playing well with this whole invalidation process.

Thanks

Reproduction

Right now, this is very difficult to provide a minimal repro, because the bug is probably only showing up at scale. Waiting for your feedback before doing anything.

System Info

Not relevant I think

Logs

Screen Shot 2021-06-08 at 6 22 08 PM


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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions