0

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 )

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.