Separate Angular production vs non-production entries #887
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Some of the entry files added as part of Angular plugin are added as production entries. However they may not be production entries. Hence causing production mode to not work as expected.
Configuration for building an Angular project is usually specified under the
build
target inside thearchitect
object of the Angular CLI workspace (akaangular.json
). However, right now the implementation is using configuration options from all targets. Which is good to capture also build options like when building for testing within thetest
target. However, in that scenario, the entries added should be non-production ones.Also, in any architect target options, the options defined in there are the default values for that target. But they may be overridden when specifying one or more alternative configurations. From those, the
production
configuration will contain production options and the rest are very probably non-production ones.Here are the options from which we're adding entries and the Angular CLI's builders they can be used with
@angular-devkit
) / ESBuild app (@angular/build
)main
scripts
fileReplacements
browser
server
ssr.entry
This PR does two main things:
fileReplacement
ones)build
target inproduction
configuration. Takes into account that if an option isn't defined in theproduction
configuration (if any), the default option will be used instead. Rest of entries will be development onesAlso the order of options has been changed so that they appear more or less chronologically ascendent. For instance,
main
option comes from the classic / old Webpack builder so appears first than newerbrowser
option in application builder.