Project created with TS instead of JS in Next.js create-next-app --example withmongodb

Dear community, I am facing a problem while starting a next.js project with mongodb: by default it builds in with typescript → OK this is normal, so I put the flag --js. If I don’t use “–example withmongodb” it works fine, project is creataed with JS instead of TS. (“npx create-next-app --js project_name”). However, with “–example with-mongodb” it keeps creating with TS, ignoring the “–js” flag apparently (“npx create-next-app --js --example with-mongodb project_name”).
May someone help me out with this?
Many thanks in advance

Hi :wave: @Nicolas_ZARAGOZA,

Welcome to the MongoDB Community forums :sparkles:

This is basically happening because it fetches the file from the following Github repo: next.js/examples/with-mongodb at canary · vercel/next.js · GitHub

And, here the files have been updated to .TSX from .JS. I’m sharing the GitHub PR for your reference: [Docs] Update mongodb example by HaNdTriX · Pull Request #39658 · vercel/next.js · GitHub. So providing the --js would probably not work here.

I hope it answers your question.

Let me know if you have any further queries.

Regards,
Kushagra

1 Like

Hi Kushagra! Many thanks for the quick solution. Best regards, Nicolas

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.