You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Actually I don't think transforminclude is needed in this case because I explicitly import Doc from "./Doc.mdx". The ?import query already do the job of transforminclude.
Describe the bug
I can't make hmr works with custom file type such as
.mdx
. It alway do full reload.Reproduction
https://github.com/csr632/test-vite/tree/hmr-bug
vite serve
and editDoc.mdx
. It alway do full reload.After some debugging, I found out that the module graph is incorrect:
![image](https://user-images.githubusercontent.com/18747423/103482167-24e47400-4e1a-11eb-8653-1c2fe836b71e.png)
For a single
.mdx
module, vite creates two duplicate ModuleNode:The
?import
query cause duplicate ModuleNode. The query is added here:vite/packages/vite/src/node/plugins/importsAnalysis.ts
Line 260 in b782af4
This line doesn't add
?import
query to.vue
file, that's why@vitejs/plugin-vue
doesn't suffer from this bug.How to fix
I suggest we remove the
vue
in this line:vite/packages/vite/src/node/utils.ts
Line 74 in 206b7b7
This is the only place where vite is still coupling with vue, giving "privilege" to vue.
After we change this line,
@vitejs/plugin-vue
should also be suffering from this bug.Then, if the bug is fixed for
@vitejs/plugin-vue
, we can be sure that no other file types will suffer from this bug.@yyx990803 Could you change this line and fix the bug for
@vitejs/plugin-vue
?System Info
vite
version: 2.0.0-beta.3The text was updated successfully, but these errors were encountered: