[X] I verified that the issue exists in the latest Next.js canary release
Provide environment information
NodeJs v18.17.1 Local Environment
Which example does this report relate to?
with-strict-csp
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
I encountered an issue with the middleware.js example provided in the Next.js documentation. When trying to use the config export with a complex matcher configuration, I received the following error:
Unable to parse config export in source file
The exported configuration object in a source file needs to have a very specific format from which some properties can be statically parsed at compile-time.
I apologize if I made any mistakes in reporting this issue. I am new to contributing to the community and I am eager to learn and help improve the project. Thank you for your understanding and patience.
Verify canary release
Provide environment information
Which example does this report relate to?
with-strict-csp
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
I encountered an issue with the middleware.js example provided in the Next.js documentation. When trying to use the config export with a complex matcher configuration, I received the following error:
export const config = { matcher: [ { source: "/((?!api|_next/static|_next/image|favicon.ico).*)", missing: [ { type: "header", key: "next-router-prefetch" }, { type: "header", key: "purpose", value: "prefetch" }, ], }, ], };
The syntax that works well is this: export const config = { matcher: [ '/((?!api|_next/static|_next/image|favicon.ico).*)', ], };![image](https://github.com/vercel/next.js/assets/36580834/31dec743-8e94-4993-93af-c08c7ad97842)
Expected Behavior
To Reproduce
just run the with-strict-csp example