-
Notifications
You must be signed in to change notification settings - Fork 26.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to parse config export in source file #63896
Comments
Updated link |
It looks like the parsing is incomplete at: next.js/packages/next-swc/crates/next-core/src/util.rs Lines 375 to 387 in 6a1e70a
matchers array.
|
I bumped into this issue after upgrading to |
I get the same issue when turning on --turbo with nextjs 14.2.1 with this matcher:
|
+1, have the exact same issue, exact same config 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" },
],
},
],
}; Unable to parse config export in source file
The exported configuration object in a source file need to have a very specific format from which some properties can be statically parsed at compiled-time. |
+1, have the exact same issue with same config too. Seems to be a 14.2 specific thing. |
14.2.1 |
We've opened a fix here: #64678 |
### What - closes #63896 PR implements parsing JSValue for the matcher config if given item is an object. We had those types already declared in place but somehow parsing ignores it.
As always you guys rock. Thank you |
Thanks @timneutkens and team! Appreciate the fix! |
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/wonderful-haibt-mw8z7p
To Reproduce
export matcher config from middleware like this:
Current vs. Expected behavior
next dev --turbo throws warnings:
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000 Available memory (MB): 32768 Available CPU cores: 10 Binaries: Node: 20.12.0 npm: 10.5.0 Yarn: N/A pnpm: 8.15.5 Relevant Packages: next: 14.2.0-canary.49 // Latest available version is detected (14.2.0-canary.49). eslint-config-next: 14.1.4 react: 18.2.0 react-dom: 18.2.0 typescript: 5.4.3 Next.js Config: output: standalone
Which area(s) are affected? (Select all that apply)
Middleware / Edge (API routes, runtime), Turbopack (--turbo)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response
PACK-2899
The text was updated successfully, but these errors were encountered: