问题
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
来源:https://stackoverflow.com/questions/41742969/how-to-apply-a-hidden-remote-sourcemap-in-safari