forked from external-repos/squoosh
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
17
src/index.ts
17
src/index.ts
@@ -1,9 +1,14 @@
|
||||
declare module '@webcomponents/custom-elements';
|
||||
|
||||
(async function () {
|
||||
if (!('customElements' in self)) {
|
||||
await import('@webcomponents/custom-elements');
|
||||
}
|
||||
|
||||
function init() {
|
||||
require('./init-app.tsx');
|
||||
})();
|
||||
}
|
||||
|
||||
if (!('customElements' in self)) {
|
||||
import(
|
||||
/* webpackChunkName: "wc-polyfill" */
|
||||
'@webcomponents/custom-elements',
|
||||
).then(init);
|
||||
} else {
|
||||
init();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user