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

Vadim Kotov
  • 7,103
  • 8
  • 44
  • 57
ptim
  • 12,355
  • 8
  • 70
  • 89
  • Possible duplicate of [iPhone: add entry to /etc/hosts without jailbreaking](http://stackoverflow.com/questions/7473939/iphone-add-entry-to-etc-hosts-without-jailbreaking) – Paul Sweatte Feb 01 '17 at 03:41
  • thanks for reading @PaulSweatte, but that question doesn't relate to source-maps :) – ptim Feb 01 '17 at 08:52
  • Not directly, but by using the hosts file, your local domain can become the [destination of the remote domain](http://stackoverflow.com/questions/1138529/accessing-clients-localhost-from-javascript-online/1138614#1138614). – Paul Sweatte Feb 01 '17 at 11:09
  • 1
    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. – ptim Feb 01 '17 at 11:32
  • 1
    I've taken care of that, and in regards to the titular question, hopefully someone else can provide more insight. – Paul Sweatte Feb 01 '17 at 14:46
  • I have the same problem – Colin Whitmarsh Feb 13 '18 at 00:54
  • 1
    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? – Trevor Johnson Apr 15 '19 at 15:58
  • Sorry, moved on from it `¯\_(ツ)_/¯` maybe Safari has started supporting it since? – ptim Apr 22 '19 at 12:23

0 Answers0