So I have a lot of internal i18n URLs and I created a function for generating those URLs.. and then used it in middleware mathcer like this:
export const config = {
matcher: [
'/((?!_next|api|favicon.ico|assets|sw.js|site.webmanifest).*)',
...generateMatchers(),
],
};
And it did not work.
I reduced generateMatchers to this:
const generateMatchers = () => {
return ['/((?!_next|api|favicon.ico|assets|sw.js|site.webmanifest).*)',];
};
And matcher to this:
export const config = {
matcher: [
...generateMatchers(),
],
};
And found out that THAT did not work. Yet it worked just fine when I did this:
export const config = {
matcher: [
'/((?!_next|api|favicon.ico|assets|sw.js|site.webmanifest).*)',
],
};
Why would that be? Is this a bug I should report ( NextJS 14.2 versions )