mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-13 09:17:20 +00:00
Add a serviceworker (#234)
* Add a serviceworker * rename + fix random extra character * Fixing worker typings * Fixing types properly this time. * Once of those rare cases where this matters. * Naming the things. * Move registration to the app (so we can use snackbar later) * Moving SW plugin later so it picks up things like HTML * MVP service worker * Two stage-service worker * Fix prerendering by conditionally awaiting Custom Elements polyfill. * Fix icon 404's * add doc comment to autoswplugin * Fix type
This commit is contained in:
committed by
Jake Archibald
parent
e4e130c5d6
commit
7d42d4f973
@@ -36,12 +36,17 @@ export default class App extends Component<Props, State> {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
import('../compress').then((module) => {
|
||||
import(
|
||||
/* webpackChunkName: "main-app" */
|
||||
'../compress',
|
||||
).then((module) => {
|
||||
this.setState({ Compress: module.default });
|
||||
}).catch(() => {
|
||||
this.showSnack('Failed to load app');
|
||||
});
|
||||
|
||||
navigator.serviceWorker.register('../../sw');
|
||||
|
||||
// In development, persist application state across hot reloads:
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
this.setState(window.STATE);
|
||||
|
||||
Reference in New Issue
Block a user