fix(vite): workaround for FOUC with tailwind (#3407)
Fixes https://github.com/denoland/fresh/issues/3379
This commit is contained in:
@@ -21,11 +21,13 @@ export function clientEntryPlugin(options: ResolvedFreshViteConfig): Plugin {
|
||||
},
|
||||
resolveId: {
|
||||
filter: {
|
||||
id: /(fresh:client-entry|fresh:client-entry-user)/,
|
||||
id: /(fresh:client-entry|fresh:client-entry-user|fresh:client-quirks)/,
|
||||
},
|
||||
handler(id) {
|
||||
if (id === modName) {
|
||||
return `\0${modName}`;
|
||||
} else if (id === "fresh:client-quirks") {
|
||||
return "@fresh/plugin-vite/client";
|
||||
} else if (id === modNameUser) {
|
||||
return clientEntry;
|
||||
}
|
||||
@@ -48,17 +50,7 @@ export function clientEntryPlugin(options: ResolvedFreshViteConfig): Plugin {
|
||||
${isDev ? 'import "preact/debug"' : ""}
|
||||
export * from "fresh/runtime-client";
|
||||
${exists ? `import "fresh:client-entry-user";` : ""}
|
||||
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.accept(() => {
|
||||
console.log("accepting")
|
||||
});
|
||||
import.meta.hot.on("fresh:reload", ev => {
|
||||
console.log(ev)
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
`;
|
||||
import "@fresh/plugin-vite/client";`;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user