fix(@angular-devkit/build-angular): bring back style tags in browser builder #28873
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.
Adds tests for extracting component styles from
<style>
tags inside of the template. The application builder didn't have this regression but I still added a test there as well to ensure we don't accidentally regress on that side in the future.So... what happened here? Basically,
readResource
returning a string and not a Promise was triggering what I suspect was unintended behavior:AdapterResourceLoader.preload
, a string result fromreadResource
leads to the function returningundefined
instead ofPromise<undefined>
.preloadAndParseTemplate
, anundefined
return value ofpreload
results in an immediatereturn Promise.resolve(null)
while aPromise.resolve(undefined)
actually populates the template cache and returns thetemplate
value.template
value, theComponentDecoratorHandler.preanalyze
method will always returntemplateStyles: []
- completely ignoring what might have actually been in the template. Which is kind of fair - it never got to see the value oftemplate
.Somewhere along the lines, something disagrees about the meaning of
undefined
and/or if there is a semantic difference betweenundefined
andPromise<undefined>
. I'm pretty sure what we want here is the behavior ofPromise<undefined>
where it actually takes the template metadata.