fix: return proper html in dev mode

Adds doctype to avoid quirks mode, supersedes #207.
Adds charset, fixes Safari issues with non-ascii characters,
closes #218, closes https://github.com/vitejs/docs-cn/issues/8
pull/227/head
Haoqun Jiang 5 years ago
parent 2330023d99
commit 2be65758eb
No known key found for this signature in database
GPG Key ID: 4AC01D095D7B6757

@ -79,8 +79,10 @@ export function createVitePressPlugin(
if (req.url!.endsWith('.html')) { if (req.url!.endsWith('.html')) {
res.statusCode = 200 res.statusCode = 200
res.end( res.end(
`<div id="app"></div>\n` + '<!DOCTYPE html><html><head><meta charset="UTF-8"></head><body>' +
`<script type="module" src="/@fs/${APP_PATH}/index.js"></script>` '<div id="app"></div>' +
`<script type="module" src="/@fs/${APP_PATH}/index.js"></script>` +
'</body></html>'
) )
return return
} }

Loading…
Cancel
Save