Skip to content

Commit

Permalink
fix: avoid eager hmr api access
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 22, 2021
1 parent 77e345f commit 705bfc3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/plugin-vue/src/main.ts
Expand Up @@ -105,7 +105,8 @@ export async function transformMain(
if (devServer && !ssr && !isProduction) {
output.push(`_sfc_main.__hmrId = ${JSON.stringify(descriptor.id)}`)
output.push(
`__VUE_HMR_RUNTIME__.createRecord(_sfc_main.__hmrId, _sfc_main)`
`typeof __VUE_HMR_RUNTIME__ !== 'undefined' && ` +
`__VUE_HMR_RUNTIME__.createRecord(_sfc_main.__hmrId, _sfc_main)`
)
// check if the template is the only thing that changed
if (prevDescriptor && isOnlyTemplateChanged(prevDescriptor, descriptor)) {
Expand Down

0 comments on commit 705bfc3

Please sign in to comment.