Skip to content

Commit

Permalink
fix: conditionally get descriptor on hmr (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz authored Aug 22, 2023
1 parent 833a7a6 commit b7b1383
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/plugin-vue/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from 'node:path'
import fs from 'node:fs'
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
import type { PluginContext, TransformPluginContext } from 'rollup'
import type { RawSourceMap } from 'source-map'
Expand Down Expand Up @@ -39,8 +40,9 @@ export async function transformMain(
const prevDescriptor = getPrevDescriptor(filename)
const { descriptor, errors } = createDescriptor(filename, code, options)

// set descriptor for HMR if it's not set yet
getDescriptor(filename, options, true, true)
if (fs.existsSync(filename))
// set descriptor for HMR if it's not set yet
getDescriptor(filename, options, true, true)

if (errors.length) {
errors.forEach((error) =>
Expand Down

0 comments on commit b7b1383

Please sign in to comment.