- When i publish new release of web app online,
the bundle.min.js needs to contain #sourceMappingURL=bundle.min.js.map
Yes.
but does the map need to be accessible from web ?
That’s up to you. If it’s uploaded as an artifact, Sentry will use that. But if it can’t find a matching artifact, Sentry attempts to fetch from your public web server.
If point.1 is true, why need to upload .min.js.map and min.js into Sentry release ?
You don’t have to. But it’s recommended because:
- It reduces latency between Sentry receiving the event and processing source maps
- Privacy – your source maps don’t have to be public.
- It avoids version mismatches where the source code/source map differs (e.g. user is using outdated code cached in browser, but Sentry fetches newest source code/map).
When initiating Raven, think I’ve done it wrong, the release: xxxxx property, should refer the Sentry release-id, instead of self-defined string/numeric value ?
This should be your release version, which can be any string (Git hash is fine).
Regarding point 1, id would prefer not to expose map-file for publics
This is why you should use artifacts.
i did have map-file uploaded to live version, but the map was never referred in .min.js, so no one would see there is a map available.
Note that the browser doesn’t attempt to download source maps unless developer tools are open. So it’s fine if your .min.js file points to an inaccessible (via the web, at least) source map file – no regular user will attempt to download this, and for the few who do have developer tools open, they’ll just get a 404 and eveything will be fine.