ternandsparrow / wild-orchid-watch-pwa

Progressive Web App for the Wild Orchid Watch citizen science project
https://app.wildorchidwatch.org
4 stars 4 forks source link

Swap from sentry-webpack-plugin to sentry-cli #28

Open tomsaleeba opened 4 years ago

tomsaleeba commented 4 years ago

Currently our build pipeline when doing a release is here: https://github.com/ternandsparrow/wild-orchid-watch-pwa/blob/0057a54/package.json#L8. The steps we do are:

  1. vue-cli build (which runs webpack)
  2. rollup build for service worker
  3. workbox post-processing of service worker

We're using the sentry-webpack-plugin and that does it's magic during the vue-cli build as that's when all the webpack plugins run.

This means the artifacts that get uploaded for a Sentry release look like (looking at the Sentry dashboard at Settings (for the project, not organisation) -> Source maps -> Archives): image

There is a service-worker.js file but it's just a tiny (1.1KB) shell of one that is generated (by the vue-cli I think).

So the problem is that we do the release before we've created the service worker (and its source map). We can't just run rollup before webpack because webpack writes out all the env vars that we need in rollup.

What we can do is stop using the webpack plugin and change to using the sentry-cli. Then we can run sentry-cli at the end and make sure everything is uploaded.

tomsaleeba commented 4 years ago

Once service-worker sourcemaps are working, we might be able to add in the terser plugin to minify the service worker. That is assuming the code minifies safely. The plugin would be added in our code here.