vbenjs / vite-plugin-theme

Vite plugin for dynamically changing the theme color of the interface
MIT License
141 stars 36 forks source link

<!DOCTYPE html> ignored in production mode #7

Closed Jenniferyingni closed 3 years ago

Jenniferyingni commented 3 years ago

This line https://github.com/anncwb/vite-plugin-theme/blob/56ab4340e428c3c4f2789706295a208441503be3/src/antdDarkThemePlugin.ts#L100

injectTo should be head

body-prepend inject dark-theme.css before <!DOCTYPE html> in html, this leads to DocType ignored in production mode and cause style differences in production mode.

 <link disabled id="__VITE_PLUGIN_THEME-ANTD_DARK_THEME_LINK__" rel="alternate stylesheet" href="/assets/app-antd-dark-theme-style.e3b0c442.css">
<!DOCTYPE html>
<html lang="en">
</html>

The same cause as this issue

https://github.com/vitejs/vite/issues/221