Configure next-translate-plugin in next.config.js
canaryYou must wrap your next.config.js with the next-translate-plugin.
Standard Webpack Configuration
If you have a simple config:
const nextTranslate = require('next-translate-plugin')
module.exports = nextTranslate()If you have an existing configuration (e.g., for Webpack), pass your config object to nextTranslate():
const nextTranslate = require('next-translate-plugin')
module.exports = nextTranslate({
webpack: (config, { isServer, webpack }) => {
return config;
}
})Turbopack Configuration (Next.js 16+)
If you are using Turbopack, you must pass { turbopack: true } as the second argument to avoid startup errors. Otherwise, the plugin will attempt to inject Webpack configurations that Turbopack does not support.
const nextTranslate = require('next-translate-plugin')
// For Next.js 16+ with Turbopack enabled
module.exports = nextTranslate({}, { turbopack: true })For a more robust detection in Next.js 16+:
const nextTranslate = require('next-translate-plugin')
const isTurbopack = !process.argv.includes('--webpack')
module.exports = nextTranslate(
{
// your Next.js config here
},
{ turbopack: isTurbopack }
)const nextTranslate = require('next-translate-plugin')
module.exports = nextTranslate({}, { turbopack: true })