Below is output document...
<script type="module">
import "/vite/hmr"
window.__DEV__ = true
window.__BASE__ = '/'
window.process = { env: { NODE_ENV: 'development' }}
</script>
<!DOCTYPE html>
<html lang="en">
<head>
should <!DOCTYPE html> be at the top?
That's fine, this is only injected during dev and all supported browsers can handle that.
This isn't true, it causes styling bugs because the DOCTYPE is ignored if it's not at the very top of the response.
Example from my own project, here is what it looks like in Vite:

Here is what it looks like in production:

The browser applies different user agent styles to different doctypes, so it's important that we can server the correct one.
fixed in 0.20.2
Most helpful comment
This isn't true, it causes styling bugs because the DOCTYPE is ignored if it's not at the very top of the response.
Example from my own project, here is what it looks like in Vite:
Here is what it looks like in production:
The browser applies different user agent styles to different doctypes, so it's important that we can server the correct one.