Add data-source="path:line" to every JSX element in development, for Vite, Next.js and Babel. Zero runtime, works in any DevTools, and great with AI coding agents.
It's your first day on a new project. You don't know the codebase at all, and your first task is to fix a button on the checkout page. You open DevTools, click the button and see this:
<button class = "MuiButtonBase-root MuiButton-root css-1x2y3z4" >
Enter fullscreen mode
Exit fullscreen mode
Now find it in the code. You search for the class name: it's generated. You search for the text: it comes from translations. You search for the component name: it's used in 140 places. You follow imports from the router to the page, from the page to a layout, from the layout to a feature folder. Tens of minutes later, sometimes hours, you finally find the line you need.
I did exactly this for years, on every new project.…