How to determine Meteor's minified JS filename

I have a situation where I need to know the filename that Meteor will use when bundling up an app and sending it up to Galaxy. I’m using Rollbar for logging, and it supports using source maps to show cleaner looking errors, but it needs to know my app’s minified JS URL, which changes every time Meteor bundles up an app.

So I have a Meteor deploy script I run when deploying to Galaxy, which ends in a call to Rollbar to report the deployment:

curl https://api.rollbar.com/api/1/deploy/ \
  -F access_token=$ACCESS_TOKEN \
  -F environment=$ENVIRONMENT \
  -F revision=$REVISION \
  -F local_username=$LOCAL_USERNAME

For source map support, it wants a minified JS filename. Is there any way to pull this off?

Even if you can get the minified JS URL, how are you planning on generating and capturing the sourcemap?

You could call WebAppInternals.setBundledJsCssUrlRewriteHook which takes a function that lets you rewrite the JS url. Essentially it’s a more configurable WebAppInternals.setBundledJsCssPrefix. You could presumably take the url that gets passed into that function and then persist it somewhere you could then access it from.

That seems awfully hacky though.

The source map already exists at .meteor/local/build/programs/web.browser/app/app.js.map.

1 Like

Hacky, but worth exploring at least. Thanks! How did you discover this BTW?

1 Like

Indeed I wonder where MongoInternals and WebAppInternals are documented…

@ffxsam I’d be extra careful with setting the js name myself because you will then need to make sure it changes (and rollbar notified of) across deployments so that it does not end up cached in your users’ browsers.

Perhaps another even more one-heck-of-a-hacky, but a write-once-and-forget way would be to create a server side route (/app.js) which parses your site’s own root url and extracts the actual js name, requests that and then streams it to rollbar.

1 Like