generated from chiffre-io/template-library
-
-
Notifications
You must be signed in to change notification settings - Fork 256
Closed
Labels
Description
Context
What's your version of nuqs?
"nuqs": "^2.2.3",
What framework are you using?
- ✅ Next.js (pages router)
Which version of your framework are you using?
next: 14.2.13 // An outdated version detected (latest is 15.1.0), upgrade is highly recommended!
eslint-config-next: N/A
react: 18.3.1
react-dom: 18.3.1
typescript: 5.6.3
Description
Apart from Frontend usage, I wanted to use my nuqs parsers to generate URLs on the server-side to be sent in emails.
For that I am trying to use a serializer on an API Route like so:
import {
createSerializer,
parseAsStringLiteral,
} from "nuqs/server";
export const universalQueryParams = {
"user-menu": parseAsStringLiteral(["open", "closed"]).withDefault("closed"),
};
const serializer = createSerializer(universalQueryParams);
export const serializeUniversalQueryParams = serializer(base, values);But sadly my Next.js-build fails, telling me:
[build:next] Failed to compile.
[build:next]
[build:next] ./node_modules/nuqs/dist/server.js
[build:next] Attempted import error: 'cache' is not exported from 'react' (imported as 'cache').
[build:next]
[build:next] Import trace for requested module:
[build:next] ./node_modules/nuqs/dist/server.js
Is there a trick to it? As I see it, this module is required for the cache feature, that I don't need. Would splitting up the path to allow direct imports of parsers/serializer help?
Reactions are currently unavailable