feat(js): Handle in_app detection for webpack namespace output #28859
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change fixes detection of
InApp
frames when webpack project is built using multiple namespaces.This will produce a path in form of
webpack://[namespace]/[path]
which ends up being something likewebpack://mylib/./some/file.js
. Where previously, non-namespaced paths were in form ofwebpack:///./some/file.js
, asnamespace
ended up being an empty string.Currently, we use to allow
a-zA-Z0-9.-_@
as namespace characters, as I don't expect anyone to use anything else. We can change it if anyone ever requests it.I'd love to write tests for it, but it would require some more refactoring, as calling the whole
process_frame
is not trivial, and I didn't want to make this PR difficult to review.webpack docs ref: https://webpack.js.org/configuration/output/#outputdevtoolnamespace
webpack docs ref: https://webpack.js.org/configuration/output/#outputdevtoolmodulefilenametemplate
ref: getsentry/sentry-javascript#3853
ref: getsentry/sentry-javascript#4012 (comment)