Skip to content
This repository has been archived by the owner on Aug 7, 2021. It is now read-only.

feat: support hidden source maps to map error stack traces from crash reports #854

Merged
merged 1 commit into from
Apr 10, 2019

Conversation

DimitarTachev
Copy link
Contributor

The hidden-source-map is the same as source-map, but it doesn't add a reference comment to the bundle. It is meant to be used when you only want SourceMaps to map error stack traces from error reports from tools like crashlytics, but you don't want to expose your SourceMap for the development tools in the release builds.

PR Checklist

Related to: #817

@ghost ghost assigned DimitarTachev Apr 8, 2019
@ghost ghost added new PR review labels Apr 8, 2019
@DimitarTachev DimitarTachev force-pushed the tachev/hidden-source-maps branch from e1fc92d to 153e796 Compare April 8, 2019 14:46
@cla-bot cla-bot bot added the cla: yes label Apr 8, 2019
@@ -96,6 +97,13 @@ module.exports = env => {
additionalLazyModuleResources: additionalLazyModuleResources
});

let sourceMapFilename = "[file].map";
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it'll be better to extract this function to common place and reuse it in all config files.

@DimitarTachev DimitarTachev force-pushed the tachev/hidden-source-maps branch from 153e796 to d27f621 Compare April 9, 2019 15:11
@DimitarTachev DimitarTachev merged commit dbcfbc2 into master Apr 10, 2019
@DimitarTachev DimitarTachev deleted the tachev/hidden-source-maps branch April 10, 2019 07:47
@ghost ghost removed new PR review labels Apr 10, 2019
@farfromrefug
Copy link

@DimitarTachev is there an example somewhere on how to actually use source map? How to have stack replaced using source maps?

@DimitarTachev
Copy link
Contributor Author

DimitarTachev commented May 7, 2019

@farfromrefug, unfortunately, this example is still in our backlog. We've just validated that the source maps are properly generated externally (having the proper content and not linked in the source files) as described in the related issue.

@edusperoni, did you try this feature and could you share some info about the steps for applying the external source maps in the error reporting tools?

@edusperoni
Copy link
Contributor

@farfromrefug @DimitarTachev

You could try online tools like https://sourcemaps.info/

Usually debugging the stacktrace with hidden sourcemaps will be a pain, but basically you'll get something like: Error on line 1 column 3000 on 1.js, you then get 1.js.map and use sourcemap-lookup like so: sourcemap-lookup 1.js.map:1:3000 and it'll output the actual line. I've done successfully in the past, so it should work :)

@farfromrefug
Copy link

@DimitarTachev @edusperoni i am more for other approaches. I actually have 2 of them:

Now i was asking here to see if the {N} team had other solutions. It's been said for a long time that {N} supports source maps, though i could never find a way to actually use them ...
It really should be handled correctly.

@gajus
Copy link

gajus commented Jul 15, 2020

It is not clear how to make the sourcemap file contenthash match the original script.

#817 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants