Skip to content

RUM-12185: Support aliased import paths for local SVG discovery - #1352

Open
jonathanmos wants to merge 1 commit into
developfrom
jmoskovich/rum-12185/support-alias-paths
Open

RUM-12185: Support aliased import paths for local SVG discovery#1352
jonathanmos wants to merge 1 commit into
developfrom
jmoskovich/rum-12185/support-alias-paths

Conversation

@jonathanmos

@jonathanmos jonathanmos commented Jul 28, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Adds support for resolving aliased local SVG imports during Session Replay asset discovery.

Supports TypeScript/JavaScript path mappings and babel-plugin-module-resolver, including .babelrc, function-form plugin configurations, and Windows paths. Includes regression coverage for the supported configurations.

Before
Screenshot 2026-07-28 at 16 24 52

After
Screenshot 2026-07-28 at 16 36 24

Motivation

What inspired you to submit this pull request?

Additional Notes

Anything else we should know when reviewing?

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Jul 28, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🔄 Datadog auto-retried 5 jobs - 4 passed on retry View in Datadog

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: ffa6d6f | Docs | Datadog PR Page | Give us feedback!

@jonathanmos
jonathanmos force-pushed the jmoskovich/rum-12185/support-alias-paths branch from 1a97eab to ffa6d6f Compare July 28, 2026 12:21
@jonathanmos
jonathanmos requested a review from Copilot July 28, 2026 12:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for resolving aliased local .svg imports during Session Replay asset discovery, so ReactNativeSVG.buildSvgMap() can map SVG components even when imports use TS/JS path mappings or babel-plugin-module-resolver.

Changes:

  • Introduces PathAliasResolver to resolve non-relative SVG import specifiers via babel-plugin-module-resolver and tsconfig.json/jsconfig.json paths.
  • Updates ReactNativeSVG.buildSvgMap() to use the resolver (and reset cached alias config between runs).
  • Adds regression tests and a benchmark scenario exercising aliased SVG imports.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
yarn.lock Adds lock entries for tsconfig-paths and babel-plugin-module-resolver (and transitive deps).
packages/react-native-babel-plugin/test/react-native-svg.test.ts Adds coverage for alias resolution via tsconfig/jsconfig + babel-module-resolver, and precedence/fallback behavior.
packages/react-native-babel-plugin/src/libraries/react-native-svg/pathAliasResolver.ts New resolver implementing alias lookup via Babel partial config + tsconfig-paths.
packages/react-native-babel-plugin/src/libraries/react-native-svg/index.ts Wires alias resolution into buildSvgMap() via resolveImportSource().
packages/react-native-babel-plugin/package.json Adds tsconfig-paths dependency and babel-plugin-module-resolver devDependency.
benchmarks/src/scenario/SessionReplay/component/Svg.tsx Adds an aliased SVG import case (Group H) to the benchmark test screen.
benchmarks/package.json Adds babel-plugin-module-resolver for the benchmark app.
benchmarks/babel.config.js Configures module-resolver alias used by the benchmark aliased SVG case.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jonathanmos
jonathanmos marked this pull request as ready for review July 28, 2026 14:37
@jonathanmos
jonathanmos requested a review from a team as a code owner July 28, 2026 14:37
@jonathanmos
jonathanmos requested a review from cdn34dd July 28, 2026 14:38
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.

2 participants