Skip to content

Commit 705bfc3

Browse files
committed
fix: avoid eager hmr api access
1 parent 77e345f commit 705bfc3

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/plugin-vue/src/main.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ export async function transformMain(
105105
if (devServer && !ssr && !isProduction) {
106106
output.push(`_sfc_main.__hmrId = ${JSON.stringify(descriptor.id)}`)
107107
output.push(
108-
`__VUE_HMR_RUNTIME__.createRecord(_sfc_main.__hmrId, _sfc_main)`
108+
`typeof __VUE_HMR_RUNTIME__ !== 'undefined' && ` +
109+
`__VUE_HMR_RUNTIME__.createRecord(_sfc_main.__hmrId, _sfc_main)`
109110
)
110111
// check if the template is the only thing that changed
111112
if (prevDescriptor && isOnlyTemplateChanged(prevDescriptor, descriptor)) {

0 commit comments

Comments
 (0)