Moh.Alkasem
Moh.Alkasem

Reputation: 59

How to create app.module.ts in an existing Angular 18 project?

I’m using Angular 18.2.8 and I’ve already created a project and worked on it. However, I noticed that the project does not include an app.module.ts file. After searching, I found that starting from Angular 17, the default structure might not include this file due to the introduction of standalone components.

However, I want to transition to the traditional module-based structure (with app.module.ts). Is there a way to generate an app.module.ts file in Angular 18 using Angular CLI? Or do I need to manually create and configure it?

I have tried this command : ng new --no-standalone

But got : Error: This command is not available when running the Angular CLI inside a workspace.

Upvotes: 1

Views: 1916

Answers (1)

mbirali
mbirali

Reputation: 66

Error: This command is not available when running the Angular CLI inside a workspace.

This error shows when you run ng new inside an existing angular project.

However:

-> If you are trying to create a new project without standalones run:

ng new <project-name> --standalone=false outside your existing angular project.

run ng new <project-name> --help for more details.

-> Also you have the option to generate a new application within your existing workspace if you want to adapt a monorepo architecture then you can run: ng g app --standalone=false

Upvotes: 0

Related Questions