Skip to content

feat: add source-map support for editor DOM mapping#347

Open
fjakobs wants to merge 1 commit intomainfrom
fjakobs/react-sourcemaps
Open

feat: add source-map support for editor DOM mapping#347
fjakobs wants to merge 1 commit intomainfrom
fjakobs/react-sourcemaps

Conversation

@fjakobs
Copy link
Copy Markdown
Collaborator

@fjakobs fjakobs commented May 5, 2026

Summary

  • Added vite-plugin-react-source-loc.ts — a Vite plugin that injects data-source="<file>:<line>:<col>" attributes onto native JSX elements, enabling the editor to map DOM elements back to source locations
  • Enabled sourcemap: true in the Vite build config
  • Added @babel/parser, @babel/traverse, and magic-string as devDependencies

Backported from the app-builder template (universe/apps/app-builder/standalone/packages/app-under-dev).

Test plan

  • Verify databricks apps init produces a working template
  • Verify built client output includes sourcemaps
  • Verify data-source attributes appear on native DOM elements in dev mode

This pull request and its description were written by Isaac.

Backport the react-source-loc Vite plugin from the app-builder
template. The plugin injects `data-source="<file>:<line>:<col>"`
attributes onto native JSX elements so the editor can map DOM
elements back to their source location. Also enables `sourcemap: true`
in the Vite build config.

Co-authored-by: Isaac
@fjakobs fjakobs requested a review from a team as a code owner May 5, 2026 17:06
@fjakobs fjakobs requested review from MarioCadenas and pkosiec May 5, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant