@@ -62,15 +62,14 @@ function vueJsxPlugin(options = {}) {
62
62
63
63
// check for hmr injection
64
64
/**
65
- * @type {{ name: string, hash: string }[] }
65
+ * @type {{ name: string }[] }
66
66
*/
67
67
const declaredComponents = [ ]
68
68
/**
69
69
* @type {{
70
70
* local: string,
71
71
* exported: string,
72
72
* id: string,
73
- * hash: string
74
73
* }[] }
75
74
*/
76
75
const hotComponents = [ ]
@@ -91,11 +90,10 @@ function vueJsxPlugin(options = {}) {
91
90
) {
92
91
hotComponents . push (
93
92
...parseComponentDecls ( node . declaration , code ) . map (
94
- ( { name, hash : _hash } ) => ( {
93
+ ( { name } ) => ( {
95
94
local : name ,
96
95
exported : name ,
97
- id : hash ( id + name ) ,
98
- hash : _hash
96
+ id : hash ( id + name )
99
97
} )
100
98
)
101
99
)
@@ -112,8 +110,7 @@ function vueJsxPlugin(options = {}) {
112
110
hotComponents . push ( {
113
111
local : spec . local . name ,
114
112
exported : spec . exported . name ,
115
- id : hash ( id + spec . exported . name ) ,
116
- hash : matched . hash
113
+ id : hash ( id + spec . exported . name )
117
114
} )
118
115
}
119
116
}
@@ -131,19 +128,15 @@ function vueJsxPlugin(options = {}) {
131
128
hotComponents . push ( {
132
129
local : node . declaration . name ,
133
130
exported : 'default' ,
134
- id : hash ( id + 'default' ) ,
135
- hash : matched . hash
131
+ id : hash ( id + 'default' )
136
132
} )
137
133
}
138
134
} else if ( isDefineComponentCall ( node . declaration ) ) {
139
135
hasDefault = true
140
136
hotComponents . push ( {
141
137
local : '__default__' ,
142
138
exported : 'default' ,
143
- id : hash ( id + 'default' ) ,
144
- hash : hash (
145
- code . slice ( node . declaration . start , node . declaration . end )
146
- )
139
+ id : hash ( id + 'default' )
147
140
} )
148
141
}
149
142
}
@@ -160,14 +153,11 @@ function vueJsxPlugin(options = {}) {
160
153
}
161
154
162
155
let callbackCode = ``
163
- for ( const { local, exported, id, hash } of hotComponents ) {
156
+ for ( const { local, exported, id } of hotComponents ) {
164
157
code +=
165
158
`\n${ local } .__hmrId = "${ id } "` +
166
- `\n${ local } .__hmrHash = "${ hash } "` +
167
159
`\n__VUE_HMR_RUNTIME__.createRecord("${ id } ", ${ local } )`
168
- callbackCode +=
169
- `\n if (__${ exported } .__hmrHash !== ${ local } .__hmrHash) ` +
170
- `__VUE_HMR_RUNTIME__.reload("${ id } ", __${ exported } )`
160
+ callbackCode += `\n__VUE_HMR_RUNTIME__.reload("${ id } ", __${ exported } )`
171
161
}
172
162
173
163
code += `\nimport.meta.hot.accept(({${ hotComponents
@@ -195,8 +185,7 @@ function parseComponentDecls(node, source) {
195
185
for ( const decl of node . declarations ) {
196
186
if ( decl . id . type === 'Identifier' && isDefineComponentCall ( decl . init ) ) {
197
187
names . push ( {
198
- name : decl . id . name ,
199
- hash : hash ( source . slice ( decl . init . start , decl . init . end ) )
188
+ name : decl . id . name
200
189
} )
201
190
}
202
191
}
0 commit comments