Skip to content

Conversation

liangmiQwQ
Copy link
Owner

This PR improve the hmr support by modifying dev mode compiler

Implemented these following features:

  • Only re-render component and keep states when there are not script changes
  • Reload the page by window.location.reload() when there are script changes

BREAKING:

  • the id of the component doesn't depend the location of the decl anymore, use the index of the .ts file instead.
  • now vue/compiler-sfc uses detached template and script in dev mode

Copy link
Owner Author

@liangmiQwQ liangmiQwQ left a comment

Choose a reason for hiding this comment

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

Addition BREAKING CHANGES:

  • CompiledComponent struct changed. code field changed to { main: string, template?: string }
  • resolve() function added hmrCache params

@liangmiQwQ liangmiQwQ merged commit 47d9ccf into main Oct 3, 2025
4 checks passed
@liangmiQwQ liangmiQwQ deleted the wip/vite-hmr branch October 3, 2025 14:03
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.

1 participant