Skip to content

fix: support .htm files in addition to .html - #21420

Open
VedantMadane wants to merge 4 commits into
vitejs:mainfrom
VedantMadane:fix/support-htm-extension
Open

fix: support .htm files in addition to .html#21420
VedantMadane wants to merge 4 commits into
vitejs:mainfrom
VedantMadane:fix/support-htm-extension

Conversation

@VedantMadane

Copy link
Copy Markdown

Fixes #10997. Vite now properly handles .htm files. Updated htmlFallback, static, indexHtml, and memoryFiles middlewares to use the existing htmlLangRE regex that matches both .html and .htm extensions.

@sapphi-red
sapphi-red marked this pull request as draft January 19, 2026 09:34
@VedantMadane

Copy link
Copy Markdown
Author

@sapphi-red when should this PR be marked ready for review?

@sapphi-red

Copy link
Copy Markdown
Member

When the CI passes

@VedantMadane
VedantMadane marked this pull request as ready for review January 26, 2026 08:01
@VedantMadane
VedantMadane force-pushed the fix/support-htm-extension branch from a15fe9f to 3d8089a Compare February 10, 2026 12:02
@VedantMadane
VedantMadane force-pushed the fix/support-htm-extension branch 3 times, most recently from 126d832 to 9f54f43 Compare June 28, 2026 19:26
@VedantMadane

Copy link
Copy Markdown
Author

Reset this branch onto latest main with a single focused commit (the previous update accidentally replayed unrelated upstream history). Diff should now only touch Vite HTML handling for .htm support per #10997.

@VedantMadane

Copy link
Copy Markdown
Author

@sapphi-red Branch was reset to a single commit on current main (the earlier tip had accidentally replayed unrelated history). Pushed an oxfmt-style formatting fix for the lint failure; once CI is fully green this should be ready for review per your note. Thanks for the pointer.

Treat .htm as HTML for dev middleware fallback, HMR, warmup, asset handling, dep scan, and SSR HTML inputs. Complements existing htmlLangRE matching.

Fixes vitejs#10997
@VedantMadane
VedantMadane force-pushed the fix/support-htm-extension branch from 2d7bac1 to 2fd90e1 Compare August 11, 2026 09:22
@VedantMadane

Copy link
Copy Markdown
Author

Rebased onto latest main to re-run CI.

Prior CI failures on Build&Test node-24 macos/windows looked flaky/unrelated to the .htm changes:

  • playground/import-assertion hook timeout (~50s)
  • transient "server is being restarted or closed" errors
  • html.spec.ts / indexHtml.spec.ts had already passed

Locally after rebase: unit tests for packages/vite/src/node/__tests__/html.spec.ts and packages/vite/src/node/server/middlewares/__tests__/indexHtml.spec.ts all passed (15/15). No merge conflicts during rebase; .htm handling preserved across client/build/plugins/middleware sites.

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.

Support parsing .htm as same as .html

2 participants