Skip to content

Add path aliases for cleaner imports #1184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matux
Copy link
Contributor

@matux matux commented May 9, 2025

Description of the change

I was getting tired of the relative subdirs when doing imports and checked if there's an idiomatic way of improving how we can refer to different paths without crawling for directories. Turns out there's, path aliases.

Added some configuration and updated the imports and it seems to be working just fine. Although I don't know if this could generate other issues for SDK users.

Note

I didn't change all the files, just the ones I've been working with recently, just as a PoC. If you guys want, I can propagate this to the rest of the SDK.

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Maintenance
  • New release

@matux matux requested a review from Copilot May 9, 2025 22:07
@matux matux self-assigned this May 9, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces path aliases to simplify module imports and reduce reliance on relative paths.

  • Updated webpack and karma configurations to include new alias settings.
  • Revised various test files to use alias-based imports instead of relative paths.
  • Adjusted source files to align with the new alias configuration.

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
webpack.config.js Added alias configurations in multiple build config sections.
test/replay/unit/replayMap.test.js Updated import paths to use new alias syntax.
test/replay/unit/queue.replayMap.test.js Changed require statement to use the new '@rollbar/queue' alias.
test/replay/unit/api.postSpans.test.js Updated require statement to leverage the '@rollbar/api' alias.
test/replay/integration/sessionRecording.test.js Revised multiple import paths to new alias-based imports.
test/replay/integration/replayMap.test.js Updated import paths for consistency with alias configuration.
test/replay/integration/queue.replayMap.test.js Adjusted import paths to use alias references.
test/replay/integration/e2e.test.js Modified import paths to reference modules via aliases.
test/replay/integration/api.spans.test.js Changed require statement to use the '@rollbar/api' alias.
src/browser/replay/replayMap.js Updated import to use new alias for the exporter module.
karma.conf.js Integrated alias configuration into the Karma Webpack config.

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