Skip to content

Commit 3fbfacd

Browse files
authored
fix(dev): ensure navigateFallbackAllowlist matches exact path (#216)
1 parent 7ef515d commit 3fbfacd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/utils/config.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,13 @@ export function configurePWAOptions(
102102
}
103103

104104
// allow override manifestTransforms
105-
if (!nuxt.options.dev && !config.manifestTransforms)
106-
config.manifestTransforms = [createManifestTransform(nuxt.options.app.baseURL ?? '/', options.outDir, appManifestFolder)]
105+
if (options.devOptions?.enabled && !options.devOptions.navigateFallbackAllowlist) {
106+
const baseURL = nuxt.options.app.baseURL
107+
// fix #214
108+
options.devOptions.navigateFallbackAllowlist = [baseURL
109+
? new RegExp(`^${baseURL.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&')}$`)
110+
: /^\/$/]
111+
}
107112

108113
if (options.pwaAssets) {
109114
options.pwaAssets.integration = {

0 commit comments

Comments
 (0)