score:0

Before I was doing it like this,

module.exports = withBundleAnalyzer(
  withPWA({
    pwa: {
      dest: 'public',
      runtimeCaching,
    },
    poweredByHeader: false,
  })
)

module.exports = 
  {
    env: {
      BASE_URL: process.env.BASE_URL,
    },
    future: {
      webpack5: true,
    },
    reactStrictMode: true,
  }

Not sure but I think you should only need to have one module.exports so I wrapped my other stuff inside the withBundleAnalyzer like this

module.exports = withBundleAnalyzer(
  withPWA({
    pwa: {
      dest: 'public',
      runtimeCaching,
    },
    poweredByHeader: false,
  }),
  {
    env: {
      BASE_URL: process.env.BASE_URL,
    },
    future: {
      webpack5: true,
    },
    reactStrictMode: true,
  }
)

score:2

Looks like this has been answered on Vercel's issues board. Copying their solution here:

These plugins are functions that enhance the configuration object, so you have to wrap them instead of providing them as arguments:

const withPWA = require('next-pwa')
const runtimeCaching = require('next-pwa/cache')


const withBundleAnalyzer = require('@next/bundle-analyzer')({
    enabled: process.env.ANALYZE === 'true',
});

module.exports = withBundleAnalyzer(withPWA({
    pwa: {
        dest: 'public',
        runtimeCaching,
    },
    poweredByHeader: false,
}));

Related Query

More Query from same tag