Invalid next.config.js options detected
See original GitHub issuenext-translate: 1.5.0
next: 12.2.3
i18n.js
const hoistNonReactStatics = require('hoist-non-react-statics');
module.exports = {
locales: ['en', 'nl'],
defaultLocale: 'en',
pages: {
'*': ['common'],
},
loadLocaleFrom: async (lang) => {
const commonTranslations = await import('translations');
const appTranslations = await import('./src/translations/');
return new Promise((resolve) =>
resolve({ ...commonTranslations[lang], ...appTranslations[lang] })
);
},
defaultNS: 'common',
staticsHoc: hoistNonReactStatics, // required for loading custom layouts with translations
};
next.config.js
/** @type {import('next').NextConfig} */
const nextTranslate = require('next-translate');
const withTM = require('next-transpile-modules')([
'components',
'hooks',
]);
const nextConfig = {
reactStrictMode: true,
};
module.exports = withTM(nextTranslate(nextConfig));
Whenever I run my app, I get following warning on my console. How can I fix this?
warn - Invalid next.config.js options detected:
[
{
"instancePath": "/i18n",
"schemaPath": "#/properties/i18n/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "loadLocaleFrom"
},
"message": "must NOT have additional properties"
},
{
"instancePath": "/i18n",
"schemaPath": "#/properties/i18n/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "defaultNS"
},
"message": "must NOT have additional properties"
},
{
"instancePath": "/i18n",
"schemaPath": "#/properties/i18n/additionalProperties",
"keyword": "additionalProperties",
"params": {
"additionalProperty": "staticsHoc"
},
"message": "must NOT have additional properties"
}
]
Is there something wrong with how I have configured things?
Issue Analytics
- State:
- Created a year ago
- Reactions:6
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Incompatible with next.js 12.2.0: "Invalid next.config.js ... - GitHub
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...
Read more >warning Invalid next.config.js when running project - nextJs
1- warn - Invalid next.config.js options detected: The root value has an unexpected property, webpack5, which is not in the list of allowed ......
Read more >invalid-images-config - Next.js
In your next.config.js file you provided an invalid config for the images field. Possible Ways to Fix It.
Read more >Plugins – Configuration – Intro to Next.js
The next.config.js file gives us the ability to do some powerful stuff. Because the config file has a convention, you should be able...
Read more >the request of a dependency is an expression nextjs - You.com
1- warn - Invalid next.config.js options detected: The root value has an unexpected property, webpack5, which is not in the list of allowed...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yes, I understand the situation. @Dragate said that he started using the new ajv validation. I guess we will wait for the new version to be released for this error to be fixed.
No. Next.js has started validating its config with
ajv. Currently,next-translateis injecting irrelevant information, which triggers this warning. For next.js, onlylocales,defaultLocale,localeDetectionanddomainsare valid.Culprit: https://github.com/vinissimus/next-translate/blob/7ebba0c71362b2dd349472d854730c098c793152/src/plugin/index.ts#L53