Home / Function/ handleParseError() — vite Function Reference

handleParseError() — vite Function Reference

Architecture documentation for the handleParseError() function in html.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  6f95d645_04ef_21fe_68b7_4c732e603766["handleParseError()"]
  f8fe0737_718a_5509_b722_473f207d5906["html.ts"]
  6f95d645_04ef_21fe_68b7_4c732e603766 -->|defined in| f8fe0737_718a_5509_b722_473f207d5906
  5800888e_ad6f_73a4_812a_c831c6a9eebf["traverseHtml()"]
  5800888e_ad6f_73a4_812a_c831c6a9eebf -->|calls| 6f95d645_04ef_21fe_68b7_4c732e603766
  8471f802_a431_7a1b_3e06_15a27483a128["formatParseError()"]
  6f95d645_04ef_21fe_68b7_4c732e603766 -->|calls| 8471f802_a431_7a1b_3e06_15a27483a128
  style 6f95d645_04ef_21fe_68b7_4c732e603766 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/html.ts lines 317–347

function handleParseError(
  parserError: ParserError,
  html: string,
  filePath: string,
  warnings: ParseWarnings,
) {
  switch (parserError.code) {
    case 'missing-doctype':
      // ignore missing DOCTYPE
      return
    case 'abandoned-head-element-child':
      // Accept elements without closing tag in <head>
      return
    case 'duplicate-attribute':
      // Accept duplicate attributes #5966
      // The first attribute is used, browsers silently ignore duplicates
      return
    case 'non-void-html-element-start-tag-with-trailing-solidus':
      // Allow self closing on non-void elements #10439
      return
    case 'unexpected-question-mark-instead-of-tag-name':
      // Allow <?xml> declaration and <?> empty elements
      // lit generates <?>: https://github.com/lit/lit/issues/2470
      return
  }
  const parseError = formatParseError(parserError, filePath, html)
  warnings[parseError.code] ??=
    `Unable to parse HTML; ${parseError.message}\n` +
    ` at ${parseError.loc.file}:${parseError.loc.line}:${parseError.loc.column}\n` +
    parseError.frame
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does handleParseError() do?
handleParseError() is a function in the vite codebase, defined in packages/vite/src/node/plugins/html.ts.
Where is handleParseError() defined?
handleParseError() is defined in packages/vite/src/node/plugins/html.ts at line 317.
What does handleParseError() call?
handleParseError() calls 1 function(s): formatParseError.
What calls handleParseError()?
handleParseError() is called by 1 function(s): traverseHtml.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free