Skip to content

feat(core): Add hook to customize source map file resolution #732

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

Merged

Conversation

thecodewarrior
Copy link
Contributor

I wasn't able to implement full integration tests for the sourcemap changes, but there's a smoke test in the playground and I added full unit tests for the function that performs the file resolution.

One of the only changes I made to the existing behavior is using url.fileUrlToPath() when the sourceMappingURL is a file:// url. I added some additional debug logging to that method as well. Now when it fails to locate a sourcemap it prints all the locations it tried, and when it succeeds it prints out the source map it chose.

Fixes #731

@chargome chargome requested review from lforst and Lms24 May 2, 2025 08:09
Copy link
Member

@andreiborza andreiborza left a comment

Choose a reason for hiding this comment

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

Hi, thanks so much for contributing this and the nice test suite!

1. Added better debug logging around the `resolveSourceMap` hook invocation
2. Expanded the `resolveSourceMap` doc comment to include more detail and an example use case
3. Added `resolveSourceMap` documentation to `generate-documentation-table.ts`
4. Removed the feature-specific playground test previously added
Copy link
Member

@andreiborza andreiborza left a comment

Choose a reason for hiding this comment

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

Looking good, thanks for contributing this!

@andreiborza andreiborza merged commit b33725e into getsentry:main May 13, 2025
22 checks passed
@thecodewarrior thecodewarrior deleted the feature/resolve-source-map-hook branch May 13, 2025 17:59
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request May 24, 2025
| datasource | package             | from  | to    |
| ---------- | ------------------- | ----- | ----- |
| npm        | @sentry/vite-plugin | 3.4.0 | 3.5.0 |


## [v3.5.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#350)

-   feat(core): Add hook to customize source map file resolution ([#732](getsentry/sentry-javascript-bundler-plugins#732))
-   fix(core): Avoid console output and telemetry init when plugins are disabled ([#741](getsentry/sentry-javascript-bundler-plugins#741))

Work in this release was contributed by [@thecodewarrior](https://github.com/thecodewarrior). Thank you for your contribution!
renovate bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request May 24, 2025
| datasource | package             | from  | to    |
| ---------- | ------------------- | ----- | ----- |
| npm        | @sentry/vite-plugin | 3.4.0 | 3.5.0 |


## [v3.5.0](https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/HEAD/CHANGELOG.md#350)

-   feat(core): Add hook to customize source map file resolution ([#732](getsentry/sentry-javascript-bundler-plugins#732))
-   fix(core): Avoid console output and telemetry init when plugins are disabled ([#741](getsentry/sentry-javascript-bundler-plugins#741))

Work in this release was contributed by [@thecodewarrior](https://github.com/thecodewarrior). Thank you for your contribution!
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.

Add hook to customize source map file resolution
4 participants