From 4cd6d80448493aa2aac62cf3304a49cc0544c06d Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 10 Sep 2021 13:22:13 +0200 Subject: [PATCH] fix(nitro): use `generate:page` hook for browser to inject sw resolves #522 --- packages/nitro/src/presets/browser.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/nitro/src/presets/browser.ts b/packages/nitro/src/presets/browser.ts index ee52d8f074..77c7c8a78e 100644 --- a/packages/nitro/src/presets/browser.ts +++ b/packages/nitro/src/presets/browser.ts @@ -53,11 +53,8 @@ if ('serviceWorker' in navigator) { serverDir: '{{ output.dir }}/public/_server' }, nuxtHooks: { - 'vue-renderer:ssr:templateParams' (params) { - params.APP += script - }, - 'vue-renderer:spa:templateParams' (params) { - params.APP += script + 'generate:page' (page) { + page.html = page.html.replace('', script + '') } }, hooks: {