Skip to content

Commit

Permalink
Merge pull request #427 from nksaraf/nksaraf-patch-1
Browse files Browse the repository at this point in the history
Update collect-styles.js to use ?inline to get the css during ssr
  • Loading branch information
nksaraf authored Dec 4, 2024
2 parents 5db4217 + 1ac2df3 commit 034b650
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/vinxi/lib/manifest/collect-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ async function findStylesInModuleGraph(vite, match, ssr) {

if (isCssFile(dep.url ?? "")) {
try {
const mod = await vite.ssrLoadModule(dep.url);
let [path, query] = dep.url.split('?')
let searchParams = new URLSearchParams(query)
searchParams.set("inline", true)
let inlineDepURL = path + '?' + searchParams.toString()
const mod = await vite.ssrLoadModule(inlineDepURL);
if (isCssModulesFile(dep.file)) {
styles[join(vite.config.root, dep.url)] = vite.cssModules?.[dep.file];
} else {
Expand Down

0 comments on commit 034b650

Please sign in to comment.