简体   繁体   中英

How to use JavaScript instead of typescript in nx monorepo setup for NextJS?

I want to create NextJS monorepo using nx using javascript. I don't want to use TypeScript for my project. But I didn't found any solution or documentation or any blog in web. My question is: Can I create nx monorepo of NextJS without using typescript? If yes how can I? or Is there any another or alternative way to create nx monorepo of NextJS without Typescript.


Below command is used to create NextJS monorepo but here by default typescript is enabled

nx g @nrwl/next:app my-new-app

Docs of nx for NextJS: https://nx.dev/packages/next


Edit: 1

I know that most of the packages are written in typescript and typescript. I think nx and NextJS also uses typescript.

I want to generate NextJS application setup in javascript. For example when we create new NextJS application we have two options

First (JavaScript setup .jsx )

yarn create next-app

Second (TypeScript setup .tsx )

yarn create next-app --typescript

Reference: NextJS docs to create new application

When we create NextJS application using nx command its by default create typescript setup. But when I want to create it for JavaScript.

How to do that?

There actually is a --js flag option to generate a next.js application using JavaScript instead of TypeScript in a nx workspace. For some reason it is not stated in the official docs.

Here's an example:

nx g @nrwl/next:application my-app --js

In case you are using VSCode I'd also recommend using the Nx Console extension ( nrwl.angular-console ). It helps a lot when generating apps, libs, components etc and shows you all available options including the --js option as a neat checkbox.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM