devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Analyze only the "client" environment (by default)

Open silvenon opened this issue 7 months ago • 6 comments

Clear and concise description of the problem

I'm building both "ssr" and "client" using Vite Environment API. It seems like DevTools is spending a lot of time analyzing both bundles when it doesn't need to analyze the ssr environment at all. I would love if there was a way to select only client considering that Environments are beginning to be quite popular (RSC, Cloudflare etc.)

Suggested solution

Additional devtools.environments option which by default could be ['client']. This way the simplicity of devtools: true could remain if someone wanted only the client environment.

Alternative

I was thinking of maybe as a consumer doing it myself by importing the DevTools plugin and manually filtering the plugin to client using applyToEnvironment, but I'd need to get acquainted with some of the internals for that because DevTools() doesn't return a single plugin object.

So no substantial alterantive really comes to mind.

Additional context

No response

Validations

  • [x] Follow our Code of Conduct
  • [x] Read the Contributing Guide.
  • [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

silvenon avatar Apr 20 '26 08:04 silvenon

Hi @silvenon , can you try [email protected] and @vitejs/[email protected] ?

webfansplz avatar May 07 '26 10:05 webfansplz

Great, appears to have skipped my ssr environment!

But what is this new session where vite.config.ts is the entry?

Image Image

silvenon avatar May 07 '26 14:05 silvenon

Great, appears to have skipped my ssr environment!

But what is this new session where vite.config.ts is the entry?

Image Image

This is an unknown session generated by rolldown. You can ignore it and focus only on the session generated by your app entry.

webfansplz avatar May 08 '26 10:05 webfansplz

Ok, if that's expected, then my feature request has been fulfilled. Thank you!

silvenon avatar May 08 '26 10:05 silvenon

I should note that at first I had two servers running, I assume one for each environment, which sounds to me like a bug because it's worse experience for people using Environments, and IIRC one of those URLs didn't work.

Then when I selected the environment I wanted via environments: ["client"] everything was fine.

I'll raise it in a separate bug report, I just have to remember 😅

silvenon avatar May 08 '26 11:05 silvenon

at first I had two servers running

Ah, this was because I also had devtools enabled in one of the environments, I forgot to exclude it, but I noticed in the meantime that you made devtools top-level-only, which is great! 💯 Now nobody can make a mistake like this anymore.

silvenon avatar Aug 08 '26 13:08 silvenon