Skip to content

HACK: tolerate files with more than one sourceMappingURL line#4

Open
moio wants to merge 1 commit into
jantimon:mainfrom
moio:hack_multiple_urls
Open

HACK: tolerate files with more than one sourceMappingURL line#4
moio wants to merge 1 commit into
jantimon:mainfrom
moio:hack_multiple_urls

Conversation

@moio
Copy link
Copy Markdown
Contributor

@moio moio commented Oct 29, 2024

Javascript files may have "sourceMappingURL" as part of their source (eg. in a string). This is explicitly not supported by the now-deprecated source-map-resolve module:

"So why is source-map-resolve deprecated? Well, source-map-resolve tries to work with source maps completely in general – support every feature and be completely language agnostic. That is a cool goal, but has a couple of flaws:

  • Finding source map comments. This is done via regex to support any language, but in reality you need to know the language to know what a comment is, as opposed to something that looks like a comment inside a string."
    https://github.com/lydell/source-map-resolve

source-map-resolve will take the first match, but if more than one exists, usually the one last will be correct.

This is a workaround for that case.

cc @jantimon

Javascript files may have "sourceMappingURL" as part of their source (eg.
in a string). This is explicitly not supported by the now-deprecated
source-map-resolve module:

"So why is source-map-resolve deprecated? Well, source-map-resolve tries
to work with source maps completely in general – support every feature
and be completely language agnostic. That is a cool goal, but has a
couple of flaws:
- Finding source map comments. This is done via regex to support any
language, but in reality you need to know the language to know what
a comment is, as opposed to something that looks like a comment inside
a string."
https://github.com/lydell/source-map-resolve

source-map-resolve will take the first match, but if more than one exists,
usually the one last will be correct.

This is a workaround for that case.

Signed-off-by: Silvio Moioli <silvio@moioli.net>
moio added a commit to moio/dashboard that referenced this pull request Oct 29, 2024
The BLOB code from web-worker is minified, and contains source maps that are then
passed over by webpack - that creates a situation of minified code inside BLOB
inside minified code which confuses some tools, eg.

jantimon/chrome-profile-sourcemap-resolver#4

That could be fixed, but the only reason to do so would be supporting very old
(pre-2013) browsers, so we are better off removing the polyfill altogether.

Signed-off-by: Silvio Moioli <silvio@moioli.net>
moio added a commit to moio/dashboard that referenced this pull request Nov 15, 2024
The BLOB code from web-worker is minified, and contains source maps that are then
passed over by webpack - that creates a situation of minified code inside BLOB
inside minified code which confuses some tools, eg.

jantimon/chrome-profile-sourcemap-resolver#4

That could be fixed, but the only reason to do so would be supporting very old
(pre-2013) browsers, so we are better off removing the polyfill altogether.

Signed-off-by: Silvio Moioli <silvio@moioli.net>
moio added a commit to moio/dashboard that referenced this pull request Nov 25, 2024
The BLOB code from web-worker is minified, and contains source maps that are then
passed over by webpack - that creates a situation of minified code inside BLOB
inside minified code which confuses some tools, eg.

jantimon/chrome-profile-sourcemap-resolver#4

That could be fixed, but the only reason to do so would be supporting very old
(pre-2013) browsers, so we are better off removing the polyfill altogether.

Signed-off-by: Silvio Moioli <silvio@moioli.net>
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