minify-js-sourcemaps icon indicating copy to clipboard operation
minify-js-sourcemaps copied to clipboard

hiding sourcemaps causes Cordova HCP to fail

Open hexsprite opened this issue 6 years ago • 8 comments

The sourcemap is listened in the __cordova/manifest.json but it results in a 404 error causing the meteor cordova plugin to give up on the download.

For now I'm just using the following in my build script:

# post-process Cordova config to remove sourcemap URLs
CORDOVA_MANIFEST=bundle/programs/web.cordova/program.json
JQ_FILTER='del(.manifest[].sourceMap) | del(.manifest[].sourceMapUrl)'
jq $JQ_FILTER $CORDOVA_MANIFEST > $CORDOVA_MANIFEST.tmp \
  && mv -f $CORDOVA_MANIFEST.tmp $CORDOVA_MANIFEST

I'm not sure if that means I won't get proper sourcemaps if an error occurs in the cordova version my app or not?

hexsprite avatar Jun 13 '19 23:06 hexsprite

Maybe I'm being overzealous and I only need to remove the sourceMap attribute and should leave sourceMapUrl so that error tracking software can still reference the proper sourcemap...

hexsprite avatar Jun 14 '19 16:06 hexsprite

Also it occurs to me that this is perhaps a "bug" in the meteor cordova plugin in that it should potentially warn instead of fail in the case that the source maps are not available...

hexsprite avatar Jun 14 '19 16:06 hexsprite

Thanks for reporting this, and for your solution... I discovered this myself after some banging of head against wall, and was glad to see I wasn't the only one, and even more happy to find a quick solution via updating my build script.

For anyone reading this who wants to take a stab at addressing the root problem of the update failing with missing sourcemaps, the error is coming from cordova-plugin-meteor-webapp – specifically, this function. But I'm going to just stick with the workaround for now.

banjerluke avatar Apr 28 '20 18:04 banjerluke

Does cordova actually use the source maps? We could have Webapp serve an empty source map instead.

zodern avatar Sep 04 '20 16:09 zodern

I don't know if Cordova itself does. But I would certainly love it if I could get sourcemapped tracebacks in my error tracking service of choice.

hexsprite avatar Sep 04 '20 16:09 hexsprite

If cordova does, we can create a source map that is valid but doesn't do anything, but it will be slower.

But I would certainly love it if I could get sourcemapped tracebacks in my error tracking service of choice.

I haven't tried it with cordova, but I thought it would work the same as with the web architectures. What have you tried and what issues exist?

zodern avatar Sep 04 '20 18:09 zodern

It may be a configuration with the error service I use (Rollbar) but they seem to fail to map the sourcemaps when using Cordova.

image

What can I do to dig a little deeper?

hexsprite avatar Sep 11 '20 14:09 hexsprite

Did you yield a solution here @hexsprite we also use Cordova and Rollbar and cant get sourcemaps. ;/

tryhardest avatar Sep 14 '22 23:09 tryhardest