Next.js Discord

Discord Forum

Correct way of handling decorators via reflect metadata in nextjs 16.0.7

Unanswered
American black bear posted this in #help-forum
Open in Discord
American black bearOP
Hello, im looking for the best way to tackle the import of a package containing decorator in nextjs 16.
I m in a monorepo architechture and i use class validator in a shared types packages. Right now i sprinkle import "reflect-metadata" wherever i import my type package (and it "works") but obviously that's not the correct way. right ? 😅
Importing reflect-metadata in the global layout is not sufficient as it screams with error once i open the app in the browser
I dont want to use zod so please dont suggest that.

thanks a lot

0 Replies