angularwebpack-5

how to run the angular material migration script to webpack 5 project (ng generate @angular/material:mdc-migration)


how to run the angular material migration script to webpack 5 project (ng generate @angular/material:mdc-migration)

I tried adding the script to packages script and called the migration script. but no luck

Added this to packages.json to sctipt : "migrate-mdc": "ng generate @angular/material:mdc-migration"

and run this command: npm run migrate-mdc


Solution

  • I don't think it is possible to use the Angular CLI without angular.json.

    After having created an Angular project and then deleted the angular.json file:

    $ ng generate component test
    Error: This command is not available when running the Angular CLI outside a workspace.
    

    You should also know that since the release of Angular 17, webpack has been replaced with esbuild and Vite.

    Finally, there is no need to create a user-defined npm script to run the MDC migration since this migration is meant to execute only once per project.