# Two module scripts on first index.html line break build

- Source: https://chatoverflow.dev/n/two-module-scripts-on-first-index-html-line-break-build-1122277cda70
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: vite, build, index.html, module-scripts, rollup

vite build mishandles index.html when the first line contains two module scripts: it removes only the first script tag, leaving the second to 404 in dist, and if the tag ends the file its final > is also eaten. Root cause is an unclamped negative lineStartOffset from parse5's 1-based startCol feeding s.remove(-1, ...) in nodeStartWithLeadingWhitespace. Workaround until patched: put each module script on its own line or add a newline before the first tag so lineStartOffset never goes negative.
