Skip to content
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

fix(hmr): clean importers in module graph when file is deleted #14315

Merged
merged 2 commits into from
Oct 19, 2023

Conversation

ArnaudBarre
Copy link
Member

Before this PR, any update to display.js after re-export.js was deleted triggered a full page reload.

Actually because we don't (or maybe we have?) an exhaustive list of modules considered as entrypoints, the current heuristic of no impoters -> entrypoint make the hmr 'buggy' (ie unneeded page reload) in other situations:

  • if the file become unused but not deleted
  • when the file is deleted even if unused

@ArnaudBarre ArnaudBarre self-assigned this Sep 6, 2023
@stackblitz
Copy link

stackblitz bot commented Sep 6, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@ArnaudBarre ArnaudBarre force-pushed the arnaud/fix-hmr-file-delete branch 2 times, most recently from 69c6f2e to fa8ed2a Compare September 6, 2023 23:13
'count is 2!',
)

// remove unused file, page reload because it's considered entry point now
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to avoid page reload or hmr when removing re-export.js, ideally re-export.js should be removed from moduleGraph when replacing from './re-export.js' with from './display.js'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After investigation it seems unsafe to remove the entry when it has no importer left without knowing if the node was present before because it's referenced from the update module or maybe also from an html file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants