Skip to content

Commit 057fdcd

Browse files
committed
fix: reset appendTo regex state and warn on unreadable HTML entries
1 parent 981491d commit 057fdcd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/core/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ function VitePluginInspector(options: VitePluginInspectorOptions = DEFAULT_INSPE
209209

210210
if (appendTo) {
211211
if ((typeof appendTo === 'string' && filename.endsWith(appendTo))
212-
|| (appendTo instanceof RegExp && appendTo.test(filename)))
212+
|| (appendTo instanceof RegExp && (appendTo.lastIndex = 0, appendTo.test(filename))))
213213
return { code: `${code}\nimport 'virtual:vue-inspector-path:load.js'` }
214214
return
215215
}
@@ -285,6 +285,7 @@ function VitePluginInspector(options: VitePluginInspectorOptions = DEFAULT_INSPE
285285
html = fs.readFileSync(resolved, 'utf-8')
286286
}
287287
catch {
288+
config.logger.warn(`[vite-plugin-vue-inspector] Failed to read HTML entry: ${resolved}`)
288289
continue
289290
}
290291
const htmlDir = path.dirname(resolved)

0 commit comments

Comments
 (0)