Skip to content

Commit

Permalink
fix: check undefined
Browse files Browse the repository at this point in the history
Co-authored-by: 翠 / green <green@sapphi.red>
  • Loading branch information
bluwy and sapphi-red committed Jul 30, 2022
1 parent eb4ab18 commit 8ef28ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/vite/src/node/plugins/html.ts
Expand Up @@ -789,10 +789,10 @@ export function preImportMapHook(
): IndexHtmlTransformHook {
return (html, ctx) => {
const importMapIndex = html.match(importMapRE)?.index
if (!importMapIndex) return
if (importMapIndex === undefined) return

const moduleScriptIndex = html.match(moduleScriptRE)?.index
if (!moduleScriptIndex) return
if (moduleScriptIndex === undefined) return

if (moduleScriptIndex < importMapIndex) {
const relativeHtml = normalizePath(
Expand Down

0 comments on commit 8ef28ee

Please sign in to comment.