Skip to content

Commit

Permalink
Legacy service worker fix again (#109)
Browse files Browse the repository at this point in the history
* Tried messing with the fallback path

* Fixed the legacy navigation thing
  • Loading branch information
torch2424 authored May 20, 2019
1 parent 1006b2c commit a9a9543
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
1 change: 0 additions & 1 deletion legacy/vaporboy-0.1.1/sw.js

This file was deleted.

8 changes: 7 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@
"husky": "^0.14.3",
"if-env": "^1.0.0",
"node-sass": "^4.9.0",
"preact-cli": "^2.2.1",
"np": "^5.0.1",
"npm-run-all": "^4.1.5",
"preact-cli": "^2.2.1",
"preact-cli-sw-precache": "^1.0.3",
"prettier": "1.12.1",
"pretty-quick": "^1.4.1",
"sass-loader": "^7.0.1",
Expand Down
10 changes: 10 additions & 0 deletions src/preact.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// https://github.com/prateekbh/preact-cli-sw-precache
const preactCliSwPrecachePlugin = require('preact-cli-sw-precache');

/**
* Function that mutates original webpack config.
* Supports asynchronous changes when promise is returned.
Expand Down Expand Up @@ -33,4 +36,11 @@ export default function(config, env, helpers) {
// https://github.com/developit/preact-cli/pull/323
// TODO: Make this absolute for production: https://github.com/developit/preact-cli/issues/279
config.output.publicPath = "";

// Need to not navigate to index.html,
// for anything beyond the legacy path
const precacheConfig = {
navigateFallbackWhitelist: [ /^(?!(\/legacy))(?!\/__).*/ ]
};
return preactCliSwPrecachePlugin(config, precacheConfig);
}

0 comments on commit a9a9543

Please sign in to comment.