How to apply a hidden / remote sourcemap in Safari?
Asked Answered
W

0

7

I'm attempting to debug an issue in my react app, that's only occurring on iOS, in production. I want to utilise a hidden sourcemap so I can debug the app's minified assets in Safari without overtly publishing the commented source.

hidden-source-map - Same as source-map, but doesn’t add a reference comment to the bundle.

https://webpack.github.io/docs/configuration.html#devtool

In Chrome I can:

  • serve the sourcemap wherever I like (eg main.js.map right next to the minified file)
  • open the minified asset in the Sources tab
  • right click and 'Add Sourcemap…', supplying the URL to main.js.map
  • Cmd-p to select a source file (eg MyComponent.js)
  • add breakpoints in the sourcemap
  • profit (have the live app pause at the correct point)

I've searched, clicked, right clicked, examined the Safari devtools carefully, read what Safari docs I could find, to no avail... the most relevant link I could find was:

In Safari 7, Source Maps are not something that you have to toggle on or off they are just always on like resources are always available in the web developer tool. How do I toggle source mapping in Safari 7?

Is this possible in Safari? Are there other approaches which might achieve a similar outcome in Safari?

Is there some tricky way to use a proxy to serve my local, unminified source to my testing iphone? (eg assets-swapper-chrome-extension. I have some sense that this might be possible, but have no idea how to do it!)

I'm on OSX 10.12, Safari 10.0.2.


Please note, this question is about using source-maps in Safari, which is not addressed in the question: iPhone: add entry to /etc/hosts without jailbreaking

Wicker answered 19/1, 2017 at 13:27 Comment(8)
Possible duplicate of iPhone: add entry to /etc/hosts without jailbreakingVarela
thanks for reading @PaulSweatte, but that question doesn't relate to source-maps :)Wicker
Not directly, but by using the hosts file, your local domain can become the destination of the remote domain.Varela
Thanks Paul, that would make the beginning of a helpful answer to the secondary question 'are there other approaches which might achieve a similar outcome', but marking the question as a possible duplicate is grounds for locking the question, which would be unfortunate, as a solution to the titular question would be valuable to me.Wicker
I've taken care of that, and in regards to the titular question, hopefully someone else can provide more insight.Varela
I have the same problemBradleigh
I'm wondering if you ever found a solution to this because I am in the same situation. If you did, could you please post it here?Firman
Sorry, moved on from it ¯\_(ツ)_/¯ maybe Safari has started supporting it since?Wicker

© 2022 - 2024 — McMap. All rights reserved.