-
-
Notifications
You must be signed in to change notification settings - Fork 321
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
Invalid next.config.js with next-pwa #367
Comments
I have the same issue :( |
This seems to have been introduced in next 12.2.3, I do not see the issue in 12.2.2 |
I guess the lib could keep using the |
@fabb I've created that in a PR by simply shifting the returned config into a variable |
Got with same issue after upgrading my next into latest version |
same error is here :( |
Meanwhile one could always delete the PWA key from the config return as @DavidSint suggested in his #368. This has fixed the issue for me. Thanks @DavidSint
|
Deleting the
|
how to new config with this release #368 ? |
Actually still throwing that error message for me next@12.2.3 I'm using next-compose-plugins and exporting like this: module.exports = composer(
[
withPreact,
withPWA,
],
nextConfig,
) |
i don't use const withPWA = require('next-pwa');
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
compiler: {
removeConsole: process.env.NODE_ENV !== 'development',
},
pwa: {
dest: 'public',
// disabled has bug, will fix on next version
disable: process.env.NODE_ENV === 'development',
register: true,
},
};
module.exports = () => {
const plugins = [withPWA];
const config = plugins.reduce((acc, next) => next(acc), {
...nextConfig,
});
return config;
}; |
For this I have that warn issue:
See more info here: https://nextjs.org/docs/messages/invalid-next-config Do you know what happened? |
@hafidzamr this approach makes this warning appear every hotreload: warn - GenerateSW has been called multiple times, perhaps due to running webpack in --watch mode. The precache manifest generated after the first call may be inaccurate! Please see https://github.com/GoogleChrome/workbox/issues/1790 for more information. |
@gamadv @darklight9811 Check the readme again. The way to include the config is slightly changed in the new version. For me it looks like this now and works fine. /** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
compiler: {
removeConsole: process.env.NODE_ENV !== 'development',
},
};
const withPWA = require('next-pwa')({
dest: 'public',
disable: process.env.NODE_ENV === 'development',
register: true,
});
module.exports = withPWA(nextConfig); Check https://github.com/shadowwalker/next-pwa#step-1-withpwa |
@saifbechan I wasnt using the new version, I updated afterwards and made the proper changes and it worked |
This worked for me! Thank you |
This is the one! Thank you so much! |
|
I was having the same issue, upgrade to 5.6.0. |
You can try this if you are using ES6 syntax. Hope it helps someone. /** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
i18n: {
locales: ["en"],
defaultLocale: "en",
},
compiler: {
removeConsole: process.env.NODE_ENV !== "development",
},
};
import { default as withPWA } from "next-pwa";
const withPWAConfig = withPWA({
dest: "public",
disable: process.env.NODE_ENV === "development",
register: true,
});
export default withPWAConfig(nextConfig); |
Summary
Since the latest version of Next.js,
next.config.js
doesn't support any more invalid properties.After running
npm run dev
, here's what we got:Related Next.js issue: vercel/next.js#38909
Versions
next-pwa
: 5.5.4next
: 12.2.3How To Reproduce
Steps to reproduce the behavior: Basically install
next-pwa
in a Next.js project (latest Next.js version) and configure it innext.config.js
with thepwa
property.Expected Behaviors
Maybe, we should start using
next-pwa
differently?No more
pwa
property insidenext.config.js
?The text was updated successfully, but these errors were encountered: