Skip to content

fix: warning for chrome devtools requests now suggests sv instead of vite plugin #13905

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

Conversation

manuel3108
Copy link
Member

Suggest setting up the devtools config using the newly release sv add devtools-json command. Follow-up for #13830
Relates sveltejs/cli#581


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

Copy link

changeset-bot bot commented Jun 19, 2025

🦋 Changeset detected

Latest commit: 5b99d16

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@svelte-docs-bot
Copy link

@manuel3108
Copy link
Member Author

No clue why this unrelated test is failing, even though I didn't even change code

Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
if (DEV && event.url.pathname === '/.well-known/appspecific/com.chrome.devtools.json') {
if (!warned_on_devtools_json_request) {
console.warn(
`\nGoogle Chrome is requesting ${event.url.pathname} to automatically configure devtools project settings. To serve this file, add this plugin to your Vite config:\n\nhttps://github.com/ChromeDevTools/vite-plugin-devtools-json\n`
`\nGoogle Chrome is requesting ${event.url.pathname} to automatically configure devtools project settings. For more details see https://svelte.dev/docs/cli/devtools-json, or to add a plugin to generate and serve this file run:\n\nnpx sv add devtools-json\n`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the message should identify where it was created, right now it sticks out in that it is a plain log without any prefix, finding the cause involves grepping node_modules.

Suggested change
`\nGoogle Chrome is requesting ${event.url.pathname} to automatically configure devtools project settings. For more details see https://svelte.dev/docs/cli/devtools-json, or to add a plugin to generate and serve this file run:\n\nnpx sv add devtools-json\n`
`\n[sveltekit] Google Chrome is requesting ${event.url.pathname} to automatically configure devtools project settings. For more details see https://svelte.dev/docs/cli/devtools-json, or to add a plugin to generate and serve this file run:\n\nnpx sv add devtools-json\n`

Copy link
Member

@dominikg dominikg Jun 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is still advertising to "just add the plugin to resolve this message". What can users do that don't want to use this feature? There's also no mention that this is connected to the chromium workspace folder feature.

It should be clear that adding this enables this feature for everyone accessing a dev-server including that via chromium - in chromium 140 there won't be a way to opt-out of this anymore.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to add the log prefix. None of SvelteKit's other log messages have a prefix, so it seems really inconsistent. I think the link to svelte.dev docs is a good hint

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. No prefix, unless we start adding a prefix to all messages that originate from Kit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dominikg great points. How about something like this? I think we can mention SvelteKit in the envelope variable name rather than log prefix

Suggested change
`\nGoogle Chrome is requesting ${event.url.pathname} to automatically configure devtools project settings. For more details see https://svelte.dev/docs/cli/devtools-json, or to add a plugin to generate and serve this file run:\n\nnpx sv add devtools-json\n`
`\nA Chromium browser is requesting ${event.url.pathname} to automatically configure devtools project settings. For more details see https://svelte.dev/docs/cli/devtools-json. This message can be disabled by installing the plugin discussed there or by setting SVELTEKIT_IGNORE_DEVTOOLS_REQUESTS=true\n`

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or at the very least make it an option that is selected by default when going through the sv create wizard

Just tried it again to be sure, but that's already the case!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why should that option be enabled by default? this is us opting in to that behavior on the users behalf.

tbh i'd question if that plugin should even be an addon in sv, it is a general DX plugin at best and if these are ok and enabled by default, i think there's a few more we might want to add, starting with vite-plugin-inspect and vite-plugin-qrcode.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tbf I'd be completely ok with both of those

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe inspect is a bit less useful for the general user because you need to kinda understand the build pipeline to use it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The difference is that the absence of the inspect and qrcode plugins doesn't result in a confusing message. Not sure why we keep going over this

Co-authored-by: Rich Harris <hello@rich-harris.dev>
Rich-Harris and others added 2 commits June 20, 2025 11:11
Co-authored-by: Dominik G. <dominik.goepel@gmx.de>
Co-authored-by: Dominik G. <dominik.goepel@gmx.de>
@dummdidumm dummdidumm merged commit 1df63bb into sveltejs:main Jun 26, 2025
15 checks passed
@github-actions github-actions bot mentioned this pull request Jun 26, 2025
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

Successfully merging this pull request may close these issues.

8 participants