just-jeb / angular-builders

Angular build facade extensions (Jest and custom webpack configuration)
MIT License
1.14k stars 198 forks source link

Support for --profile option in ng build when using the custom-webpack builder #280

Open subodhkumar opened 5 years ago

subodhkumar commented 5 years ago

Describe the bug Support for the '--profile' option in the 'ng build' needs to be added.

To Reproduce Steps to reproduce the behavior:

  1. Create a Angular project using 'ng cli'
  2. Go to 'angular.json' & replace the 'custom-webpack' builder for 'build' option
  3. Run 'ng build --profile' or 'ng build --prod --profile'
  4. The generated 'speed-measure-plugin.json' file will not have any content.

OR (preferred way)

a link to a repository with minimal reproduction

Expected behavior The 'speed-measure-plugin.json' should have build stats

Builder: custom-webpack:browser

subodhkumar commented 5 years ago

@meltedspark thanks for the tool... i am working on a change to have this support. Shall i create a pull request for it once done?

just-jeb commented 5 years ago

Yes, please do. However, keep in mind a few things:

Otherwise any contribution is very appreciated, thank you!

subodhkumar commented 5 years ago

Thanks @meltedspark ,

Please find my initial analysis below, Default 'browser' builder of @angular-devkit has code which will wrap generated webpack config inside 'speed-measure-webpack-plugin' to generate output as json ('speed-measure-plugin.json), if '--profile' option in enabled. In the custom-webpack builder ,webpack configuration prepared by the @angular-devkit is read and additional configurations are added, which may be causing the issue.

Please correct if there is any miss, & also will have it validated at my end.

just-jeb commented 4 years ago

@subodhkumar any update on this? Does default builder support this option while the custom does not?

arturovt commented 4 years ago

@subodhkumar

Could you provide a reproduction? I went via your instructions and it seems like this expression:

The generated 'speed-measure-plugin.json' file will not have any content.

is not truthy. See below:

image