Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
More work on fixing #985.
I'm not a huge fan of this implementation, because we now basically have two different "production" implemenations - one using
node server.js
(using Express + Sapper middleware), and another using Sapper export plus a static fileserver in Now.But it does work, and the difference between the two is minimal. The only thing I had to do slightly differently was handling dynamic URLs like
/accounts/<accountId>
- instead of letting Sapper middleware handle it, I just returnservice-worker-index.html
. This is fine, because literally the only case where this matters is if a user is on one of those dynamic pages, and either 1) hard-refreshes, and 2) doesn't have a Service Worker, and refreshes. Those cases are so rare that the difference doesn't matter much.More troubling is having to manually manage this entire CSP mess, as well as a big regex to identify the dynamic URLs. But since we have a dev server to catch any mistakes I might make, I'm not too concerned. But it could be improved.