Skip to content

Commit

Permalink
Disable JS preloading in dev
Browse files Browse the repository at this point in the history
  • Loading branch information
shiro committed Apr 4, 2024
1 parent 4a99566 commit 6429fae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/articles/2024-03-31-linaria-in-solid-js/article.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Linaria in solid js
# Linaria in Solid.js

something new 2

something new

hi
1 change: 0 additions & 1 deletion src/entry-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
import { mount, StartClient } from "@solidjs/start/client";

mount(() => <StartClient />, document.getElementById("app")!);
console.log(import.meta.MIB);
10 changes: 5 additions & 5 deletions vite/SSR/SSRPreloadDev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<link
Expand Down Expand Up @@ -66,7 +66,7 @@ const collectRec = (
}
}

if ([".css", ".scss"].some((x) => 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 = "';
Expand All @@ -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);
}
};
Expand Down Expand Up @@ -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),
];
};

0 comments on commit 6429fae

Please sign in to comment.