From 6429fae0f01dc1fff0ae487bd54ed082753c1d41 Mon Sep 17 00:00:00 2001 From: shiro Date: Thu, 4 Apr 2024 14:07:33 +0900 Subject: [PATCH] Disable JS preloading in dev --- .../2024-03-31-linaria-in-solid-js/article.mdx | 5 +++-- src/entry-client.tsx | 1 - vite/SSR/SSRPreloadDev.tsx | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/articles/2024-03-31-linaria-in-solid-js/article.mdx b/src/articles/2024-03-31-linaria-in-solid-js/article.mdx index 466690c..1174a80 100644 --- a/src/articles/2024-03-31-linaria-in-solid-js/article.mdx +++ b/src/articles/2024-03-31-linaria-in-solid-js/article.mdx @@ -1,5 +1,6 @@ -# Linaria in solid js +# Linaria in Solid.js + +something new 2 -something new hi diff --git a/src/entry-client.tsx b/src/entry-client.tsx index 07c3085..15c463b 100644 --- a/src/entry-client.tsx +++ b/src/entry-client.tsx @@ -3,4 +3,3 @@ import { mount, StartClient } from "@solidjs/start/client"; mount(() => , document.getElementById("app")!); -console.log(import.meta.MIB); diff --git a/vite/SSR/SSRPreloadDev.tsx b/vite/SSR/SSRPreloadDev.tsx index 4f11965..69293c1 100644 --- a/vite/SSR/SSRPreloadDev.tsx +++ b/vite/SSR/SSRPreloadDev.tsx @@ -11,10 +11,10 @@ const getModuleGraph = () => { const fixUrl = (url: string) => (url.startsWith("/") ? url : "/" + url); -const wihtoutQuery = (url: string) => url.split("?")[0]; +const withoutQuery = (url: string) => url.split("?")[0]; function renderAsset(url: string) { - const urlWithoutSearch = wihtoutQuery(url); + const urlWithoutSearch = withoutQuery(url); if (urlWithoutSearch.endsWith(".woff2")) return ( wihtoutQuery(node.url).endsWith(x))) { + if ([".css", ".scss"].some((x) => withoutQuery(node.url).endsWith(x))) { if (!node.transformResult?.code) return; const start = 'const __vite__css = "'; @@ -79,7 +79,7 @@ const collectRec = ( .replaceAll("\\\\", "\\"); CSSOutput.push([node.id, code]); - } else if ([".js"].some((x) => wihtoutQuery(node.url).endsWith(x))) { + } else if ([".js"].some((x) => withoutQuery(node.url).endsWith(x))) { JSOutput.push(node.url); } }; @@ -111,6 +111,6 @@ export const preloadSSRDev = () => { return [ renderAsset("/fonts/inter-3.19-roman/Inter-Regular-Roman.woff2"), ...inlineCSSToPreload.map(([id, code]) => renderInlineCSS(id, code)), - ...filesToPreload.map(fixUrl).map(renderAsset), + // ...filesToPreload.map(fixUrl).map(renderAsset), ]; };