Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Questions about vite-plugin-ssr-css #659

Open
silvenon opened this issue Oct 26, 2024 · 0 comments
Open

Questions about vite-plugin-ssr-css #659

silvenon opened this issue Oct 26, 2024 · 0 comments

Comments

@silvenon
Copy link

silvenon commented Oct 26, 2024

I've been trying out your plugin for providing SSR CSS developer experience on Vite v6.0.0-beta.5, and have run into several problems, assuming that the plugin is intended to be used by adding it to my Vite config and nothing else.

  • the source in resolveId never starts with just the virtual module name, it starts with \0 because it's linked in the HTML with /@id/__x00__, I'm not sure what's the intention there
  • why does the load hook have this?
    if (!url.searchParams.has("direct")) {
      code = `export default ${JSON.stringify(code)}`;
    }
    why is it export default instead of just the content of the CSS? I haven't been able to get the injected link to actually produce the collected content, though, even though it manages to collect the CSS successfully…
  • this plugin should produce the collected CSS during dev, but Vite's <style> tags still get injected, no? doesn't that result in duplicate styles? or is that not considered problematic?
  • traversing modules also traverses Sass partials for me, so ?direct requests were failing for those because they were missing context, I've modified the traverse function to exit upon hitting a Sass file

I've tried to adapt the plugin to my Environment API setup, but since I don't really understand all of the plugin and that part of Vite deeply enough (despite your helpful comments) I didn't manage to succeed.

I can create a repro if it will help. I was just tired and wanted to write down everything that I can remember.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant