Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

One of the glob patterns doesn't match any files #80

Open
leonwang908 opened this issue Mar 31, 2024 · 6 comments
Open

One of the glob patterns doesn't match any files #80

leonwang908 opened this issue Mar 31, 2024 · 6 comments

Comments

@leonwang908
Copy link

here is log from console.

mode      generateSW
precache  91 entries (1653.86 KiB)
files generated
  .svelte-kit/output/server/sw.js
  .svelte-kit/output/server/workbox-f3e6b16a.js
warnings
  One of the glob patterns doesn't match any files. Please remove or fix the following: {
  "globDirectory": "/home/hogehoge/.svelte-kit/output",
  "globPattern": "prerendered/**/*.html",
  "globIgnores": [
    "server/*.*",
    "server/sw.js",
    "server/workbox-*.js"
  ]
}

here is log from brower

    at O.createHandlerBoundToURL (https://snaplnk.net/workbox-f3e6b16a.js:1:13245)
    at Object.createHandlerBoundToURL (https://snaplnk.net/workbox-f3e6b16a.js:1:14916)
    at https://snaplnk.net/sw.js:1:6473
    at https://snaplnk.net/sw.js:1:565

here is my setting

import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vitest/config';
import { SvelteKitPWA } from '@vite-pwa/sveltekit'

export default defineConfig({
	plugins: [
		sveltekit(),
		SvelteKitPWA({
			registerType: 'autoUpdate',
			strategies: 'generateSW',
			devOptions: {
				enabled: true,
				type: 'module',
				navigateFallback: '/',
			},
			manifest: {
				name: 'hogehoge,
				short_name: 'hogehoge',
				description: 'hogehoge',
				theme_color: '#808080',
				display: 'standalone',
				icons: [
					{
						src: 'pwa.png',
						sizes: '512x512',
						type: 'image/png',
						purpose: 'masked any'
					},
				],
				start_url: '/',
			},
			workbox: {
				globPatterns: ['client/**/*.{js,css,ico,png,svg,webp,woff,woff2}']
			},
		}),
	],
});
@userquin
Copy link
Member

userquin commented Mar 31, 2024

You should prerender navigate fallback page for offline support, I guess the warning is about missing html entries in prerendered folder.

You sw will fail when registeribg since there is no navigate fallback in sw precache manifest.

@leonwang908
Copy link
Author

My apps is forum app and it's no need to work under offline. is that any option to disable offline support?

@userquin
Copy link
Member

userquin commented Apr 1, 2024

vite-pwa/vite-plugin-pwa#402 (comment) (you also need to exclude html files, include globIgnores: ["prerendered/**/*.html" iirc glob ignores takes preferences over glog includes)

@leonwang908
Copy link
Author

understand. let me try in maintenance time

@leonwang908
Copy link
Author

workbox: {
				globPatterns: ['client/**/*.{js,css,ico,png,svg,webp,woff,woff2}'],
				globIgnores: ["prerendered/**/*.html"]
			},

I added globIgnores: ["prerendered/**/*.html"] to vite.config.ts and it looks not effected.
it show me warning like

PWA v0.19.7
mode      generateSW
precache  91 entries (1656.24 KiB)
files generated
  .svelte-kit/output/server/sw.js
  .svelte-kit/output/server/workbox-f3e6b16a.js
warnings
  One of the glob patterns doesn't match any files. Please remove or fix the following: {
  "globDirectory": "/home/hogehoge/.svelte-kit/output",
  "globPattern": "prerendered/**/*.html",
  "globIgnores": [
    "prerendered/**/*.html",
    "server/*.*",
    "server/sw.js",
    "server/workbox-*.js"
  ]
}

@homerjam
Copy link

homerjam commented Apr 3, 2024

I have this error too, it seems like the options in vite.config.js are ignored 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants