Skip to content

fix: handle asynchronous minification and HTML emission errors - #1895

Open
OskarEichler wants to merge 1 commit into
jantimon:mainfrom
OskarEichler:codex/async-error-propagation
Open

fix: handle asynchronous minification and HTML emission errors#1895
OskarEichler wants to merge 1 commit into
jantimon:mainfrom
OskarEichler:codex/async-error-propagation

Conversation

@OskarEichler

Copy link
Copy Markdown

Fixes

  • Await HTML minification so async parser failures receive the existing actionable error message (including minify: false). The synchronous catch currently misses rejections from html-minifier-terser.
  • Forward late HTML-emission rejections to Webpack's completion callback. Errors during filename interpolation or asset emission currently leave that callback uncalled and cause an unhandled rejection.

postProcessHtml remains Promise-returning; making it async also removes redundant Promise wrappers. Successful HTML output, plugin options, and supported Node versions are unchanged. No breaking API changes or dependency changes.

Verification

  • All 161 existing tests across four suites pass.
  • JavaScript lint, formatting, spelling, and git diff --check pass.
  • Sixteen successful-output comparisons against unmodified upstream cover production/development and disabled/default/custom minification.
  • Inline checks cover real asynchronous parse failures, invalid HTML input, unchanged synchronous/asynchronous non-parser errors, and real Webpack compilations with injected filename/asset-emission failures. The completion callback now fires exactly once with the error.
  • Plain tsc reports existing TS2802 on the unrelated Set spread in getAssetFiles; reproduced against unmodified upstream using the same compiler host. tsc --downlevelIteration passes with this patch. No TypeScript configuration changes are included.
  • No test files were added or changed. The full CI OS/Node-version matrix was not run locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant