Allow to define basePath for script files
See original GitHub issueI have successfully configured and installed sourcemaps in rollbar (https://rollbar.com/docs/source-maps/).
Unfortunately, with current behaviour, you assume that my assets are located under only one url (f.e. http://domain.com/js/app.js
).
However, what if my assets are stored under 4 different urls? (f.e. http://userone.domain.com/js/app.js
, http://usertwo.domain.com/js/app.js
) . I have to upload the same sourcemap twice for each minified_url
, even if those files are exactly the same.
My actual example & problem: I am using Rollbar.js in my mobile Apache Cordova application. Source urls are a little bit strange there.
Even though, I managed to synchronise the sourcemaps on Android by setting sourceMappingURLPrefix: 'file:///android_asset/www/js'
in gulp-rollbar.
Unfortunately, it’s not so easy for iOS, as the assets path for the iOS app is random: f.e. file:///private/var/mobile/Containers/Bundle/Application/9A5697CB-45C3-46A6-9A97-4EC7A088CDC7/CordovaSample.app/www/js/app.js
, where 9A5697CB-45C3-46A6-9A97-4EC7A088CDC7
is a random hash being different with every deploy. Thus, it’s almost impossible for me to make the sourcemaps working on the iOS app.
It would be great if I could set an “alias_name” for given script url, f.e.
scriptUrls = {
"file:///private/var/mobile/Containers/Bundle/Application/9A5697CB-45C3-46A6-9A97-4EC7A088CDC7/CordovaSample.app/www/js/app.js": "/www/js/app.js"
}
OR
just configure a basePath for all script files in Rollbar.configure
, f.e.:
Rollbar.configure({
basePath: "file:///private/var/mobile/Containers/Bundle/Application/9A5697CB-45C3-46A6-9A97-4EC7A088CDC7/CordovaSample.app/www/"
})
This way, I would be able to upload sourcemaps by just setting minified_url
to /js/app.js
, instead of the full URL (and I wouldn’t need to upload them more than once if there’s one file having many URLs).
Would you mind adding such a feature? Do you have any idea if I could accomplish it right now with some kind of hack, changing the JSON payload before sending to rollbar, or something?
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (2 by maintainers)
Okay, I managed to make it with simple
transform()
function 😉This solved my problem completely, so the issue can be closed 😉
A note about it in the documentation however, could be helpful IMHO ;P
Hey jtomaszewski,
This is a bit old issue but I am searching for the solution you already gave for this. I just don’t understand very well where this code needs to be set.
Im having the same problem with this: '-F minified_url=file:///android_asset/www/js/app-min.js ’ +
For android is good, but for iOS, I don’t know what to set since as you said, different hash is always generated.
Im sending this to Rollbar from gulp.
But at the end it doesn’t get transformed properly for iOS, I need the solution for iOS.
Any help would be highly appreciated.
Thanks in advance.