Skip to content

Commit

Permalink
feat(js): Handle in_app detection for webpack namespace output (#28859)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek authored and vuluongj20 committed Sep 30, 2021
1 parent ceb2287 commit d582f1b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/sentry/lang/javascript/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@
)
VERSION_RE = re.compile(r"^[a-f0-9]{32}|[a-f0-9]{40}$", re.I)
NODE_MODULES_RE = re.compile(r"\bnode_modules/")
# Default Webpack output path using multiple namespace - https://webpack.js.org/configuration/output/#outputdevtoolmodulefilenametemplate
# eg. webpack://myproject/./src/lib/hellothere.js
WEBPACK_NAMESPACE_RE = re.compile(r"^webpack://[a-zA-Z0-9_\-@\.]+/\./")
SOURCE_MAPPING_URL_RE = re.compile(b"//# sourceMappingURL=(.*)$")
CACHE_CONTROL_RE = re.compile(r"max-age=(\d+)")
CACHE_CONTROL_MAX = 7200
Expand Down Expand Up @@ -1006,6 +1009,8 @@ def process_frame(self, processable_frame, processing_task):
# (i.e. node_modules)
if "/~/" in filename:
filename = "~/" + abs_path.split("/~/", 1)[-1]
elif WEBPACK_NAMESPACE_RE.match(filename):
filename = re.sub(WEBPACK_NAMESPACE_RE, "./", abs_path)
else:
filename = filename.split("webpack:///", 1)[-1]

Expand Down

0 comments on commit d582f1b

Please sign in to comment.