-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
hmr work not correctly with jsx plugin for vue3 #1486
Comments
Yeah, it looks like to be safe we should just update all components exported from the file. PR welcome. |
Ok I will do it this week |
@yyx990803 I found these seems no way to fully reload a module without refresh, not like webpack, vite use native esmodule system and there is no module proxy. Emm... so if I find same code other then component changed I can only refresh page to reload right? If I miss something please give me some advice. |
The reason it's not updating now is because the component's own code did not change, so it didn't even trigger an update. You need to remove all the hash checks comparing prev/next components in the plugin codegen so it always updates every exported component. |
Yeah I know this will work for components. But what if this module export something not component, do we have a method to tell other module which imported this module? or maybe we don't need to care about this. |
If not every export is a component, then the module cannot be HMRed (no |
If i use tsx/jsx in a <script lang="tsx">
export default defineComponent({
setup: (props) => {
return () => (
<>
<h1>hello</h1>
<h1>world</h1>
</>
);
},
});
</script>
<style scoped>
...
</style>
When i change JSXElement like If i just use in export default defineComponent({
setup: (props) => {
return () => (
<>
<h1>hello</h1>
<h1>world</h1>
</>
);
},
}); It work. Is this a bug? |
@SterbenJ The problem I encountered is the same as yours. Both the syntax of the 我遇到的问题与你一致,使用 |
Describe the bug
When using jsx-plugin.
In this example, if I update the default exported component, it will hot update successfully. But if I edit the
getText
function for example changehello
toHi
. The component will not hot update.It mainly because jsx-plugin only detect component update, but in file written in jsx, people may split some logic into functions or some others.
Since we can't hold component state when hmr in jsx, maybe just not
accept
, let all component rerender is a better choice?I will be happy to make a pr to help after we determine the best way to handle hmr in jsx.
Reproduction
I guess it's clear enough...
System Info
vite
version: 2.0.0-beta.7The text was updated successfully, but these errors were encountered: