Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move <!DOCTYPE html> to top of generated HTML #221

Closed
ais-one opened this issue May 22, 2020 · 3 comments
Closed

Move <!DOCTYPE html> to top of generated HTML #221

ais-one opened this issue May 22, 2020 · 3 comments

Comments

@ais-one
Copy link
Contributor

ais-one commented May 22, 2020

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?

@yyx990803
Copy link
Member

That's fine, this is only injected during dev and all supported browsers can handle that.

@adamwathan
Copy link

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:

image

Here is what it looks like in production:

image

The browser applies different user agent styles to different doctypes, so it's important that we can server the correct one.

@yyx990803
Copy link
Member

fixed in 0.20.2

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants