You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My best guess for a fix is that it should only strip the slash if it has stripped cwd, leaving other absolute paths alone.
Reproduction
Not reproducible in repl as process isn't defined there
go to https://vite.new/svelte , inspect the site with the counter button, enter document.getElementsByTagName('button')[0].__svelte_meta.loc.file in console and note that the path does not start with a /
Describe the bug
The svelte compiler adds information about the compiled files filename to the output. While doing so, it strips cwd and a leading slash.
Stripping the leading slash breaks absolute paths that don't start with cwd as the result would be
which is relative and does not exist within cwd (/home/user/elsewhere/)
This results in svelte-inspector not being able to open components referenced via absolute paths, which can happen in a monorepo setup, see vite discord: https://discord.com/channels/804011606160703521/1075471833442287677
Strip happens here: https://github.com/sveltejs/svelte/blob/master/src/compiler/compile/Component.ts#L144
Introduced here: #1499
My best guess for a fix is that it should only strip the slash if it has stripped cwd, leaving other absolute paths alone.
Reproduction
Not reproducible in repl as
process
isn't defined therego to https://vite.new/svelte , inspect the site with the counter button, enter
document.getElementsByTagName('button')[0].__svelte_meta.loc.file
in console and note that the path does not start with a /Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: