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

Configuration seems to struggle with Next.js PWA configurations #44

Open
haykam821 opened this issue Nov 29, 2022 · 3 comments
Open

Configuration seems to struggle with Next.js PWA configurations #44

haykam821 opened this issue Nov 29, 2022 · 3 comments

Comments

@haykam821
Copy link

I am working on migrating a web application to Next.js in this repo. However, I am running into an issue where the basePath is seemingly not injected.

My configuration looks like the following:

const withPWA = require("next-pwa")({
	dest: "public",
});

module.exports = withPWA({
	compiler: {
		styledComponents: true,
	},
	reactStrictMode: true,
});

However, the step using the actions/configure-pages action outputs this warning from #43:

Warning: Unsupported configuration file extension. Currently supported extensions: ".js", ".cjs", ".mjs"

Other than the fact that the next.config.js configuration uses the .js extension, it seems that the action fails to inject properties into a configuration wrapped by a higher-order withPWA function. A more useful error is not logged, so this issue is hard to diagnose.

@zvailanu98
Copy link

I'm having the same issue with withContentlayer(). A lot of Next.js "plugins" wrap the config in this way, which doesn't seem to work with this action.

@DenizUgur
Copy link

Weird that no workaround or fix has been proposed here

@haykam821
Copy link
Author

This action seems to support wrapping calls already, but the functionality for doing so seems to not be enabled. The ConfigParser constructor simply needs to be passed allowWrappingCall: true in its settings:

// Parse the configuration file and try to inject the Pages configuration in it
const settings = getConfigParserSettings({ staticSiteGenerator, generatorConfigFile, siteUrl })
new ConfigParser(settings).injectAll()

The parsing for wrapping calls only seems to allow one wrapping call, though, so multiple higher-order functions would not be usable even if allowWrappingCall: true was specified.

danielptv added a commit to stadt-karlsruhe/open-data-dashboard that referenced this issue May 11, 2024
* Remove [actions/configure-pages](https://github.com/actions/configure-pages) from workflow due to missing support for wrapping Next.js config in higher-order functions (actions/configure-pages#44)
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

No branches or pull requests

4 participants
@DenizUgur @haykam821 @zvailanu98 and others