Open boredland opened 1 year ago
Feel free to PR to adapt this config property https://github.com/aralroca/next-translate/blob/master/src/plugin/index.ts#L5
any updates? Faced with same problem when adding next-translate plugin to next.config
next-translate plugin overrides nextConfig
const nextTranslate = require('next-translate');
const nextConfig = {};
if (process.env.NODE_ENV !== 'development') {
nextConfig.assetPrefix = '/appName';
nextConfig.rewrites = async () => {
return [
{ source: '/appName/_next/:path*', destination: '/_next/:path*' },
{ source: '/appName/static/:path*', destination: '/static/:path*' },
];
};
}
module.exports = nextTranslate({ ...nextConfig });
any updates? Faced with same problem when adding next-translate plugin to next.config
next-translate plugin overrides nextConfig
const nextTranslate = require('next-translate'); const nextConfig = {}; if (process.env.NODE_ENV !== 'development') { nextConfig.assetPrefix = '/appName'; nextConfig.rewrites = async () => { return [ { source: '/appName/_next/:path*', destination: '/_next/:path*' }, { source: '/appName/static/:path*', destination: '/static/:path*' }, ]; }; } module.exports = nextTranslate({ ...nextConfig });
This looks like a different error. We are supporting Next.js configuration and rewrites should work, but remember that adding the locales these rewrites should be adapted to the locales. You should add locales: false
on you rewrites, otherwise is looking /en/_next/:path*
. This is documented in the Next.js core documentation of rewrites: https://nextjs.org/docs/api-reference/next.config.js/rewrites#rewrites-with-i18n-support
What version of this package are you using?
1.6.0
What operating system, Node.js, and npm version?
linux, node 16, npm 8
What happened?
the next config can either be an object:
or a (async) function:
both examples are from the next documentation.
When passing a function to next-translate tho, it replaces that function with an object, discarding all the previous content.
I prepared a minimal reproduction here.
What did you expect to happen?
I expected the config to be extended either way.
Other config wrappers, like @sentry/nextjs, work like that.
Are you willing to submit a pull request to fix this bug?
If this is confirmed indeed a bug, I give it a try.