next-compose-plugins: Incompatible with next.js 12.2.0: "Invalid next.config.js options detected"
When compiling with next.js 12.2.0, this warning is shown, even when an empty array is passed for the plugins parameter:
warn - Invalid next.config.js options detected:
[
{
"instancePath": "",
"schemaPath": "#/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "webpackDevMiddleware"
},
"message": "must NOT have additional properties"
},
{
"instancePath": "",
"schemaPath": "#/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "configOrigin"
},
"message": "must NOT have additional properties"
},
{
"instancePath": "",
"schemaPath": "#/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "target"
},
"message": "must NOT have additional properties"
},
{
"instancePath": "",
"schemaPath": "#/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "analyticsId"
},
"message": "must NOT have additional properties"
},
{
"instancePath": "",
"schemaPath": "#/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "webpack5"
},
"message": "must NOT have additional properties"
},
{
"instancePath": "/amp/canonicalBase",
"schemaPath": "#/properties/amp/properties/canonicalBase/minLength",
"keyword": "minLength",
"params": {
"limit": 1
},
"message": "must NOT have fewer than 1 characters"
},
{
"instancePath": "/basePath",
"schemaPath": "#/properties/basePath/minLength",
"keyword": "minLength",
"params": {
"limit": 1
},
"message": "must NOT have fewer than 1 characters"
},
{
"instancePath": "/generateEtags",
"schemaPath": "#/properties/generateEtags/isFunction",
"keyword": "isFunction",
"params": {},
"message": "must pass \"isFunction\" keyword validation"
},
{
"instancePath": "/i18n",
"schemaPath": "#/properties/i18n/type",
"keyword": "type",
"params": {
"type": "object"
},
"message": "must be object"
},
{
"instancePath": "/webpack",
"schemaPath": "#/properties/webpack/isFunction",
"keyword": "isFunction",
"params": {},
"message": "must pass \"isFunction\" keyword validation"
}
]
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 60
- Comments: 26
Commits related to this issue
- Won't cause errors on next config Rewrote next config so it won't complain during dev or build as a workaround for `next-compose-plugins` Ref: https://github.com/cyrilwanner/next-compose-plugins/iss... — committed to fusky-labs/searchpets by deleted user 2 years ago
- build: Remove next-compose-plugins It was causing a number of warnings when building: ``` warn - Invalid next.config.js options detected: - The root value has an unexpected property, webpackDevM... — committed to Royal-Navy/design-system-docs by jpveooys a year ago
- build: Remove next-compose-plugins It was causing a number of warnings when building: ``` warn - Invalid next.config.js options detected: - The root value has an unexpected property, webpackDevM... — committed to Royal-Navy/design-system-docs by jpveooys a year ago
- build: Remove next-compose-plugins It was causing a number of warnings when building: ``` warn - Invalid next.config.js options detected: - The root value has an unexpected property, webpackDevM... — committed to Royal-Navy/design-system-docs by jpveooys a year ago
- build(Nextjs): Remove next-compose-plugins It was causing a number of warnings when building: ``` warn - Invalid next.config.js options detected: - The root value has an unexpected property, web... — committed to Royal-Navy/design-system-docs by jpveooys a year ago
- updated `next.config.js` (reference: https://github.com/cyrilwanner/next-compose-plugins/issues/59#issuecomment-1341060113) — committed to htbkoo/personal-portfolio by htbkoo a year ago
I ditched
next-compose-pluginssince it’s unmaintained and replaced it with these lines:I faced the same problem, but it worked fine by removing
defaultConfig.Used Fix: @meiblorn @comment.
From:
To:
Just ignore default config. Seems, its NextJS related issue.
Even using
defaultConfigas is throws an error:Hence, its not a
next-compose-pluginspackage error.So, as a workaround, use it like below (just ignore defaultConfig existence):
If you want to keep the default config you could do the following:
I am using
next-compose-pluginswithnext-pwa,@sentry/nextjsand@next/bundle-analyzerand I get similar warningswhy i got like this
with config
For anyone looking for a full
next.config.jssolution that removes the warnings, here’s what I use:What you can do instead is:
and then as before
I think all of the codes above make the things complex, you can just use one reduce line for composing all the plugins.
For anyone who switched to @gendaineko2222’s suggested solution (like I did) and ran into a
TypeError: plugin is not a functionwhen passing a plugin as an array with some plugin-specific configuration (as outline here: https://github.com/cyrilwanner/next-compose-plugins/#configuration-object), this is the change that I had to make to handle that case:For those using the
.reduce()strategy, please be aware that the return value ofplugin(acc)isn’t always a function (depending on the plugin you use: https://github.com/getsentry/sentry-javascript/issues/6447#issuecomment-1340671081I’d suggest the following edit:
it keeps telling me TypeError : plugin is not a function
i got fixing config next-pwa (v 5.5.5) with this config
but i go twice print
[PWA] Compile serverlike thisor
[PWA] PWA support is disabledI’m using
next-pwa,@sentry/nextjsand@next/bundle-analyzer. Did this withoutnext-compose-pluginsWorks fine 👍🏻
I was still seeing the warnings after this change because of what was in
defaultConfig. This workaround resolved them for me, and still maintained thedefaultConfigusage. Still seeing the warning about.assetPrefixas it errors if you remove the field.Related issue: https://github.com/vercel/next.js/issues/39161
I don’t understand, I don’t have webpack customisations but I get lots of warnings:
Next yells about:
For me the warnings are gone, so I guess one of your plugins or your config sets
webpackDevMiddlewareetc. somewhere?Just spread them too.