Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

"globPatterns" is not a supported parameter - using example from docs #3508

Closed
ezekiel747 opened this issue May 21, 2021 · 5 comments
Closed

Comments

@ezekiel747
Copy link

Hi, i'm encountering an error when trying to use next-offline with expo:

npx next build
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
info - Using external babel configuration from /Users/dnicoara/extra/c-songs/babel.config.js
info - Creating an optimized production build
Failed to compile.

Please check your GenerateSW plugin configuration:
"globPatterns" is not a supported parameter.. "globDirectory" is not a supported parameter.

This is the next.config.js content:

const { withExpo } = require('@expo/next-adapter');
const withOffline = require('next-offline');
const withFonts = require('next-fonts');
const withImages = require('next-images');

module.exports = withOffline({
  workboxOpts: {
    swDest: 'workbox-service-worker.js',

    /* changing any value means you'll have to copy over all the defaults  */
    /* next-offline */
    globPatterns: ['static/**/*'],
    globDirectory: '.',
    runtimeCaching: [
      {
        urlPattern: /^https?.*/,
        handler: 'NetworkFirst',
        options: {
          cacheName: 'offlineCache',
          expiration: {
            maxEntries: 200,
          },
        },
      },
    ],
  },
  ...withExpo(withImages(withFonts({
    projectRoot: __dirname,
  }))),
});

Could you please help?
Thanks.

@byCedric
Copy link
Member

Hi @ezekiel747! This looks like an issue with next-offline, and specifically this issue. You can try running your project without next-offline, if that works fine (even though offline is disabled) it's that library.

@ezekiel747
Copy link
Author

Thank you for responding.
I've discovered that due to a change in a more recent version of workbox-webpack-plugin (not sure which one),
the these are indeed no longer valid options:

  • globPatterns
  • globDirectory

we may use instead the "include" option, which require another format instead (regex).

@ezekiel747
Copy link
Author

The instructions in Expo docs should be checked and corrected / updated to actually work with the current version of next-offline and / or its workbox-related dependencies.
I would rather let someone more experienced with nextjs & workbox than doing a PR myself.
Thanks!

@kchangch
Copy link

kchangch commented Aug 8, 2022

is there anywhere where I can find what to use instead of globPatterns, globDirectory, and globIgnores?

@ezekiel747
Copy link
Author

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

No branches or pull requests

3 participants