You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so for whatever reason i cannot run m2s inside a next.js route.
"next": "^13.0.5",
"react": "^18.2.0",
"typescript": "latest",
when i run m2s from a command (schema.ts) with ts-node-dev with a tsconfig with module"commonjs" everything works fine.
"target": "es2017",
"module": "CommonJS",
but if i try to run the same code from inside a next.js .tsx file it crashes. i can get it to work if i do m2s(new Model()) instead of m2s(Model) but then it mangles certain things like Scehma.Types.ObjectIds.
my next.js tsconfig is set to:
"target": "es5",
"module": "esnext"
Is there any way to make m2s work in a .tsx file (NextJs "page")?
as a workaround for now i have a commands/ folder which has a schema.ts file which i run with ts-node-dev to create the schemas and write them to .json files.
i then load those .json files for use with react-jsonschema-form and swagger-jsdoc. this is really nice cuz i can build my schema definitions with m2s and load them into swagger-jsdoc and use @Swagger comments to markup my api routes.
the only downside is every time i change the model i have to re-run schema.ts instead of being able to build the schema dynamically for react-jsonschema-form. but being able to run m2s inside a tsx file would change that and make the framework more developer friendly.
The text was updated successfully, but these errors were encountered:
so for whatever reason i cannot run m2s inside a next.js route.
"next": "^13.0.5",
"react": "^18.2.0",
"typescript": "latest",
when i run m2s from a command (schema.ts) with ts-node-dev with a tsconfig with module"commonjs" everything works fine.
"target": "es2017",
"module": "CommonJS",
but if i try to run the same code from inside a next.js .tsx file it crashes. i can get it to work if i do m2s(new Model()) instead of m2s(Model) but then it mangles certain things like Scehma.Types.ObjectIds.
my next.js tsconfig is set to:
"target": "es5",
"module": "esnext"
Is there any way to make m2s work in a .tsx file (NextJs "page")?
as a workaround for now i have a commands/ folder which has a schema.ts file which i run with ts-node-dev to create the schemas and write them to .json files.
i then load those .json files for use with react-jsonschema-form and swagger-jsdoc. this is really nice cuz i can build my schema definitions with m2s and load them into swagger-jsdoc and use @Swagger comments to markup my api routes.
the only downside is every time i change the model i have to re-run schema.ts instead of being able to build the schema dynamically for react-jsonschema-form. but being able to run m2s inside a tsx file would change that and make the framework more developer friendly.
The text was updated successfully, but these errors were encountered: