Skip to content

Commit 72347b7

Browse files
committed
fix: handle hot module replacement
1 parent ccab9bb commit 72347b7

File tree

1 file changed

+13
-15
lines changed

1 file changed

+13
-15
lines changed

src/vue.ts

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -182,21 +182,18 @@ export class Vue<Props = unknown>
182182
}
183183

184184
// from Vue Loader
185-
if (Ctor.render) {
186-
options.render = Ctor.render
187-
}
188-
189-
if (Ctor.__file) {
190-
options.__file = Ctor.__file
191-
}
192-
193-
if (Ctor.__cssModules) {
194-
options.__cssModules = Ctor.__cssModules
195-
}
196-
197-
if (Ctor.__scopeId) {
198-
options.__scopeId = Ctor.__scopeId
199-
}
185+
const injections = [
186+
'render',
187+
'__file',
188+
'__cssModules',
189+
'__scopeId',
190+
'__hmrId',
191+
] as const
192+
injections.forEach((key) => {
193+
if (Ctor[key]) {
194+
options[key] = Ctor[key]
195+
}
196+
})
200197

201198
return options
202199
}
@@ -243,6 +240,7 @@ export class Vue<Props = unknown>
243240
static __file?: string
244241
static __cssModules?: Record<string, any>
245242
static __scopeId?: string
243+
static __hmrId?: string
246244

247245
constructor(props: Props, ctx: SetupContext) {
248246
defineGetter(this, '$props', () => props)

0 commit comments

Comments
 (0)