nuxt icon indicating copy to clipboard operation
nuxt copied to clipboard

Warning - One of the glob patterns doesnt match any files.

Open crunchwrap89 opened this issue 1 year ago • 6 comments

I get a warning message when building my project:

warnings: 
One of the glob patterns doesn't match any files. Please remove or fix the following: {
  "globDirectory": "/Users/elmaco/WebstormProjects/GeoQuestr/.output/public",
  "globPattern": "**/_payload.json",
  "globIgnores": [
    "**/node_modules/**/*",
    "sw.js",
    "workbox-*.js"
  ]
}

Even if my globPatterns array is empty.

How can it be? I dont understand how to fix this issue.

pwa: {
...
    registerType: 'prompt',
    workbox: {
      maximumFileSizeToCacheInBytes: 50 * 1024 * 1024, // 50MB
      globPatterns: [],
      navigateFallback: null,
      runtimeCaching: [
        {
          urlPattern: /\.(?:js|mjs|cjs|mp4|png|webp|svg|ico|css|glb|ttf|webmanifest|txt)$/, 
          handler: 'CacheFirst', // Fetch from cache, fallback to network
          options: {
            cacheName: 'js-cache',
            expiration: {
              maxEntries: 20,
              maxAgeSeconds: 360 * 24 * 60 * 60, // Cache JS files for 360 days
            },
            cacheableResponse: {
              statuses: [0, 200],
            },
          },
        },
      ],
    },

crunchwrap89 avatar Oct 22 '24 18:10 crunchwrap89

Hey @crunchwrap89 are you by any chance using nuxt 4 compat?

moshetanzer avatar Nov 17 '24 21:11 moshetanzer

Also getting this.

Edit: According to the docs, enabling experimental payloadExtraction produces this file and adds it to the glob patterns. https://vite-pwa-org.netlify.app/frameworks/nuxt.html#payload-extraction

Nuxt apparently enables this by default now. Manually disabling payloadExtraction makes the error go away: https://nuxt.com/docs/guide/going-further/experimental-features#payloadextraction

What is the benefit of this feature? I don't know

galaxyblur avatar Feb 13 '25 19:02 galaxyblur

I am running latest version of nuxt, but have had this warning for atleast a year.

Den tors 13 feb. 2025 20:52galaxyblur @.***> skrev:

also getting this

— Reply to this email directly, view it on GitHub https://github.com/vite-pwa/nuxt/issues/169#issuecomment-2657574063, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEUQCTXU2I6QW5JYXIK7PA32PTZXFAVCNFSM6AAAAABQNCG4SOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNJXGU3TIMBWGM . You are receiving this because you were mentioned.Message ID: @.***> [image: galaxyblur]galaxyblur left a comment (vite-pwa/nuxt#169) https://github.com/vite-pwa/nuxt/issues/169#issuecomment-2657574063

also getting this

— Reply to this email directly, view it on GitHub https://github.com/vite-pwa/nuxt/issues/169#issuecomment-2657574063, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEUQCTXU2I6QW5JYXIK7PA32PTZXFAVCNFSM6AAAAABQNCG4SOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNJXGU3TIMBWGM . You are receiving this because you were mentioned.Message ID: @.***>

crunchwrap89 avatar Feb 14 '25 15:02 crunchwrap89

I'll check if the payload option moved from experimental option

userquin avatar Feb 14 '25 15:02 userquin

I solved the problem with this solution.

experimental: { payloadExtraction: false, appManifest: false, }, pwa: { workbox: { navigateFallback: "/", globPatterns: [], globIgnores: [ '/_payload.json', '_nuxt/builds//.json', '/node_modules//' ] }, }

alireza013013 avatar Jul 16 '25 13:07 alireza013013

Hi,

It seems the issue only occurs when this setting is on:

experimental: { payloadExtraction: true, },

Warning dissappears with setting: payloadExtraction: false.

"payloadExtraction Enables extraction of payloads of pages generated with nuxt generate."

Since i am not using nuxt generate to build, i am using a SPA/SSR app with "nuxt build" only, i guess no _payload.json is created for me, and therefore it will not match in the globpattern.

Would be good if this lib only added "/_payload.json" to the globPatterns if using nuxt generate.

crunchwrap89 avatar Jul 21 '25 07:07 crunchwrap89