0

I’m working with a Svelte 5 application that has already been deployed in production, and I don’t have access to its source code. I’d like to inspect or interact with some of its internal variables and functions from the browser developer console.

Here’s what I’ve tried so far:

  • Looked for global variables on window or document (no luck so far).
  • Tried using the Svelte DevTools extension, but it doesn’t support Svelte 5 yet.
  • Used breakpoints in DevTools to pause execution and identify functions in scope, but I haven’t been able to call them from the console once execution resumes.

Is there a reliable way (e.g., through DevTools, function references, or any hooks Svelte leaves in production builds) to access variables or functions from a deployed Svelte 5 app in the browser console?

1 Answer 1

1

There are no global variables except __svelte.v which contains version info.

You can lift variables from a local scope by setting properties on window when execution is halted somewhere, but that is about it.

Sign up to request clarification or add additional context in comments.

2 Comments

Can you say how to set properties on window soo that I can read variables from a local scope?
It's just window.whateverYouWant = localVariable in the console, then whateverYouWant is a globally accessible variable containing the value of the local variable. Of course if the variable changes locally, this will not be captured unless you define a function returning the variable instead. This is overall pretty pointless, though, because you need to use the debugger every time to set this up.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.