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

Fix pwa configuration, current release only works with default values #384

Closed
wants to merge 5 commits into from
Closed

Fix pwa configuration, current release only works with default values #384

wants to merge 5 commits into from

Conversation

marcofranssen
Copy link

@marcofranssen marcofranssen commented Aug 11, 2022

resolves #383

@shadowwalker could you make a 5.5.6 release including this fix?

I have tested the changes on my nextjs project using.

cd next-pwa
yarn link
cd ../my-blog
yarn link next-pwa
yarn build

index.js Outdated Show resolved Hide resolved
@@ -20,11 +20,12 @@ module.exports = (nextConfig = {}) => {
webpack,
buildId,
dev,
config: { distDir = '.next', pwa = {}, pageExtensions = ['tsx', 'ts', 'jsx', 'js', 'mdx'], experimental = {} }
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the pwa part in here resulted in not taking the pwa config at all.

let basePath = options.config.basePath
if (!basePath) basePath = '/'
const basePath = options.config.basePath || '/'
const { pwa = {} } = nextConfig
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the real fix, the rest is a bit of code cleanup.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!! It works 🎉

@Lukasdotcom
Copy link
Contributor

Lukasdotcom commented Aug 11, 2022

This is almost the same thing as #372 . Except that it also does some code cleanup.

@ymchun
Copy link

ymchun commented Aug 11, 2022

// Next 12.2.3+ logs errors if the `pwa` field is returned since it is not recognized

the comment here explained why delete pwaNextConfig.pwa is added. since Next.js will issue a warning for unknown properties of nextConfig.

I believe the Next.js team prefer let nextConfig be nextConfig and handle lib config as the second argument.

@marcofranssen
Copy link
Author

@shadowwalker could we take this fix to be able to release a patch for the current version? In parallel we should start on introducing the breaking change following best practices as discussed in #381.

@levifry
Copy link

levifry commented Sep 6, 2022

Need this PR approved ASAP. Package is broken until approved

@Lukasdotcom
Copy link
Contributor

@levifry This PR does the same thing as #372 and that was already merged.

@marcofranssen marcofranssen deleted the fix-pwa-config branch September 7, 2022 08:07
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

Successfully merging this pull request may close these issues.

sw.js and workbox-*.js do not end up in public folder
4 participants