Skip to content

Commit b7b1383

Browse files
authored
fix: conditionally get descriptor on hmr (#236)
1 parent 833a7a6 commit b7b1383

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/plugin-vue/src/main.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import path from 'node:path'
2+
import fs from 'node:fs'
23
import type { SFCBlock, SFCDescriptor } from 'vue/compiler-sfc'
34
import type { PluginContext, TransformPluginContext } from 'rollup'
45
import type { RawSourceMap } from 'source-map'
@@ -39,8 +40,9 @@ export async function transformMain(
3940
const prevDescriptor = getPrevDescriptor(filename)
4041
const { descriptor, errors } = createDescriptor(filename, code, options)
4142

42-
// set descriptor for HMR if it's not set yet
43-
getDescriptor(filename, options, true, true)
43+
if (fs.existsSync(filename))
44+
// set descriptor for HMR if it's not set yet
45+
getDescriptor(filename, options, true, true)
4446

4547
if (errors.length) {
4648
errors.forEach((error) =>

0 commit comments

Comments
 (0)