🌐
Svelte
svelte.dev › docs › svelte › $inspect
$inspect • Docs • Svelte
This rune, added in 5.14, causes the surrounding function to be traced in development. Any time the function re-runs as part of an effect or a derived, information will be printed to the console about which pieces of reactive state caused the effect to fire. <script> import { doSomeWork } from ...
🌐
Svelte
svelte.dev › tutorial › svelte › inspecting-state
Reactivity / Inspecting state • Svelte Tutorial
You can customise how the information is displayed by using $inspect(...).with(fn) — for example, you can use console.trace to see where the state change originated from:
🌐
GitHub
github.com › sveltejs › svelte › issues › 14794
$inspect.trace() is missing information or Svelte is running effects ...
Describe the bug It seems that there might be room for improvement for $inspect.trace(). There are cases where the trace doesn't highlight anything as changed. If nothing really changed, then w...
Published: Dec 21, 2024
Author: webJose
🌐
GitHub
github.com › wallabyjs › console-ninja › issues › 251
[Feature]: Svelte 5 $inspect rune support. · Issue #251 · ...
Svelte 3 & 4 had $: console.log(...) ... wonders, svelte 5 removes $: syntax, and replaces $: console.log(...) with $inspect(...), with does not work with console ninja. ... When implementing support for this, be careful of how to handle '.with' feature: $inspect(x); // default console.log $inspect(x).with(console.trace); $inspect(x, ...
Published: Dec 25, 2023
Author: alex-knyaz
🌐
GitHub
github.com › trbrc › svelte-inspect
GitHub - trbrc/svelte-inspect: console.log()-like interactive ...
console.log()-like interactive inspector for Svelte 3 - trbrc/svelte-inspect
Starred by 35 users
Forked by 2 users
Languages: Svelte 78.2% | JavaScript 21.8%
🌐
GitHub
github.com › sveltejs › svelte-devtools
GitHub - sveltejs/svelte-devtools: A browser extension to inspect ...
After installing you will see a new tab in Developer Tools. This tab displays a tree of Svelte components, HTMLx blocks, and DOM elements that were rendered on the page. By selecting one of the nodes in the tree, you can inspect and edit its current state in the panel to the right.
Starred by 1,5 mil users
Forked by 80 users
Languages: Svelte 57.1% | JavaScript 30.6% | TypeScript 8.3% | CSS 3.4% | HTML 0.6%
🌐
GitHub
github.com › sveltejs › vite-plugin-svelte › blob › main › docs › inspector.md
vite-plugin-svelte/docs/inspector.md at main · sveltejs/vite-...
Svelte plugin for https://vite.dev. Contribute to sveltejs/vite-plugin-svelte development by creating an account on GitHub.
Author: sveltejs
🌐
GitHub
github.com › sveltejs › svelte › pull › 14801
fix: ensure $inspect.trace indicated dirty traced deps correctly ...
Should fix the bug where a traced dependency that was mutated as part of the same effect incorrectly gets marked as not changed. I haven't had time to extensively test it though so leaving ...
Author: sveltejs
Find elsewhere
🌐
Joy of Code
joyofcode.xyz › svelte-inspector
Never Search For Svelte Components Again
Hover over elements and open Svelte components in your editor using the Svelte inspector.
🌐
Stack Overflow
stackoverflow.com › questions › 57390682 › debugging-with-svelte
Debugging with svelte - Stack Overflow

The {@debug} template syntax can be used as an alternative to console.log.

You can place it in your html code, and then open the devtools of your browser.

If your component goes through the @debug statement while the devtools are open, it will automatically pause the execution.

edit

if you have this svelte code

<script> let name = 'world'; </script> {@debug name} <h1>Hello {name}!</h1>

it will compile to

// more code c: function create() { { const { } = ctx; console.log({ name }); // <-- Note those 2 lines debugger; // <-- corresponding to the @debug statement } t0 = space(); h1 = element("h1"); t1 = text("Hello "); t2 = text(name); t3 = text("!"); add_location(h1, file, 6, 0, 56); } // more code

It will run every time the component is rendered. Including the first time. It isn't bound to the value change if said value change doesn't trigger a new render.

If you want to bind a console log to a value change you need to use a reactive statement in your script

$: console.log(name);

or

$: value, console.log('value has been updated');

the debugger statement stop the script execution in both Chrome 76 and Firefox Quantum 68

Answer from Morphyish on stackoverflow.com
🌐
Sentry
docs.sentry.io › platforms › javascript › guides › sveltekit › tracing
Set Up Tracing | Sentry for SvelteKit
If you set both, tracesSampler will take precedence. In both, hooks.client.js and hooks.server.js, set: ... import * as Sentry from "@sentry/sveltekit"; Sentry.init({ dsn: "https://examplePublicKey@o0.ingest.sentry.io/0", // We recommend adjusting this value in production, or using `tracesSampler` ...
🌐
Svelte
svelte.dev › docs › svelte › @debug
{@debug ...} • Docs • Svelte
The {@debug ...} tag offers an alternative to console.log(...). It logs the values of specific variables whenever they change, and pauses code execution if you have devtools open · The {@debug} tag without any arguments will insert a debugger statement that gets triggered when any state changes, ...
🌐
Madewithsvelte
madewithsvelte.com › svelcro
Svelcro - Component Performance Tracker - Made with Svelte
May 21, 2022 - Component Performance Tracker · It lets you view your components as a dependency tree or hierarchy, list their state & properties and monitor their render time."
🌐
npm
npmjs.com › package › svelte-inspect
svelte-inspect - npm
Svelte object inspector. Latest version: 0.1.3, last published: 3 years ago. Start using svelte-inspect in your project by running `npm i svelte-inspect`. There are no other projects in the npm registry using svelte-inspect.
    » npm install svelte-inspect
  
Published: Jan 20, 2022
Version: 0.1.3
🌐
Svelte
svelte.dev › docs › svelte › compiler-errors
Compiler errors • Docs • Svelte
`$inspect.trace(...)` must be the first statement of a function body · The arguments keyword cannot be used within the template or at the top level of a component ... Mixing old (on:%name%) and new syntaxes for event handling is not allowed. Use only the on%name% syntax ... %message%. The browser will 'repair' the HTML (by moving, removing, or inserting elements) which breaks Svelte...
🌐
GitHub
github.com › sveltejs › svelte › issues › 14869
$inspect.trace() typings discagree with docs · Issue #14869 · ...
Describe the bug The $inspect.trace() docs say the first argument is optional yet the typings says it's required. The docs could be expanded a little. For example, I got to Error entries in the tra...
Published: Dec 31, 2024
Author: SteveALee
Brave Search uses private usage metrics to estimate overall activity and performance. You can turn off this option in Settings. Learn more.