Svelte components have file location meta data

Svelte nodes have a __svelte_meta object in development mode that contains the file location of the component that rendered that node.

{
    "loc": {
        "file": "src/routes/index.svelte",
        "line": 18,
        "column": 4,
        "char": 358
    }
}

You an try it out on StackBlitz. Inspect an element using the Chrome Dev Tools and use the console:

$0.__svelte_meta
Screenshot 2022-05-07 at 9 25 47 AM

($0 references the last selected DOM element. It is part of the DevTool's Console API)

Learn more about __svelte_meta: