sveltejs / svelte-devtools

A browser extension to inspect Svelte application by extending your browser devtools capabilities
https://chromewebstore.google.com/detail/svelte-devtools/kfidecgcdjjfpeckbblhmfkhmlgecoff
MIT License
1.4k stars 79 forks source link

No Svelte app detected on SvelteKit #219

Closed SapiensAnatis closed 1 month ago

SapiensAnatis commented 1 month ago

Thanks for making this extension! In my day job I find the react devtools to be very useful so was excited to learn there is something similar for Svelte. Unfortunately I cannot get it to work on my system :(

Describe the bug The extension panel is visible, but the dev tools will not open

To Reproduce This happens on my main project, but I was able to reproduce with the template:

$ pnpm create svelte@latest my-app
$ cd my-app 
$ pnpm install
$ pnpm run dev -- --open

then in Firefox and Chromium I get

Svelte DevTools

No Svelte app detected

Not working? Did you...

    Build with dev mode enabled?
    Use Svelte version ^4.0.0?

The options I used in the template were

create-svelte version 6.2.0

┌  Welcome to SvelteKit!
│
◇  Which Svelte app template?
│  SvelteKit demo app
│
◇  Add type checking with TypeScript?
│  No
│
◇  Select additional options (use arrow keys/space bar)
│  none
│
└  Your project is ready!

The package.json of the demo app shows it is Svelte 4,

{
        "name": "my-app",
        "version": "0.0.1",
        "scripts": {
                "dev": "vite dev",
                "build": "vite build",
                "preview": "vite preview"
        },
        "devDependencies": {
                "@fontsource/fira-mono": "^4.5.10",
                "@neoconfetti/svelte": "^1.0.0",
                "@sveltejs/adapter-auto": "^3.0.0",
                "@sveltejs/kit": "^2.0.0",
                "@sveltejs/vite-plugin-svelte": "^3.0.0",
                "svelte": "^4.2.7",
                "vite": "^5.0.3"
        },
        "type": "module"
}

And SvelteKit should set the dev mode automatically (indeed, import { dev } from '$app/environment' is true)

Expected behavior The dev tools appear and allow me to inspect my app

Environment

ignatiusmb commented 1 month ago

Hey, thanks for giving it a try! If the panel is visible, then the extension should be working as expected. Can you try...

  1. with no other extensions enabled, or
  2. on a fresh install of a browser with just the devtools, or
  3. on a different machine/OS?

Otherwise, I don't really know what else could be causing the issue there, I might need you to install from a temporary branch with some logging and see if it prints anything for you. I'll create and push it when all the following above doesn't work.

On that note, if you're downloading from the releases tab and installing it from the .zip file (not .xpi), you're probably running it as an unpacked extension, and it might have limited site access or some other restricted permissions that needs to be enabled in the settings.

SapiensAnatis commented 1 month ago

Ah - I got it to work, I needed to click on the extension menu and grant it permissions for localhost. 🤦

Sorry for the user error!