Skip to content
Discussion options

You must be logged in to vote

Just in case anyone has the same issue, here's my workaround based on the solution from #2282 (comment) and which is working in Vite@7.2.4 :

// server.ts

 const getAppCss = (vite?: ViteDevServer, ctxModulesIds: Set<string> = new Set()) => {
  let appCss = '';

  const collectCssUrls = (
    modules: Set<ModuleNode>,
    isCss: (module: ModuleNode) => boolean,
    checked: Set<string> = new Set(),
  ) => {
    for (const module of modules) {
      if (!module.id || (module.id && checked.has(module.id))) {
        continue;
      }
      checked.add(module.id);
      if (isCss(module)) {
        appCss += `<link rel="stylesheet" type="text/css" href="${module.url}" data-vite-dev-initial />\n`

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by coldshine
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant