Repository navigation
fix(@schematics/angular): migrate secondary entry point style options in use-library-builder - #34468
Conversation
… in use-library-builder migration read only `lib.entryFile` from secondary `ng-package.json` and then deleted it, so its `styleIncludePaths` and `sass` options were lost and next build failed with `Can't find stylesheet to import` library builder has single global `stylePreprocessorOptions`, so secondary optoins are now merged into it next to primary ones
There was a problem hiding this comment.
Code Review
This pull request updates the use-library-builder migration schematic to collect and merge styleIncludePaths and sass options from secondary entry points. Feedback on the changes highlights an issue where existing sass options in the workspace configuration (angular.json) are overwritten rather than merged, and a code suggestion is provided to preserve and merge these existing options.
…options in use-library-builder Co-authored-by: Alan Agius <alanagius@google.com>
|
This PR was merged into the repository. The changes were merged into the following branches:
|
|
This pull request has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
PR Type
What is the current behavior?
Issue Number: N/A
use-library-builderdrops style options of secondary entry pointsng-packagr's own
scss-pathssample shows it:sub-module/ng-package.jsonhas ownstyleIncludePaths, after migrationsub-module/assetsis just gone fromincludePathsfindSecondaryEntryPointsreads onlylib.entryFilefrom secondary config and then file is deleted, sostyleIncludePathsandsassset per entry point are lost (primary ones are migrated)Small workspace with
sub/ng-package.jsonsetting"styleIncludePaths": ["../styles", "./styles"]builds fine with ng-packagr, after migrationng buildfails:Secondary
sass.silenceDeprecationsis lost too, so@importdeprecation warning comes backWhat is the new behavior?
Library builder has one global
stylePreprocessorOptions, so include paths of secondary entry points are resolved from their own diretory and merged intoincludePathsafter primary ones, duplicates removedsassdeprecation lists of all entry points are merged same waySame workspace builds after migration (both packages built from this branch) and styles in output match ng-packagr build
New case in
migration_spec.tssetsstyleIncludePathsandsasson primary and ontestingentry point, it fails on mainDoes this PR introduce a breaking change?
Other information
Because options become global, partial with same name in two include paths now resolves to first one for every entry point
If you prefer warning for secondary options instead of merging, I can switch to that
Also
lib.cssUrl: "none"is dropped without any message, library builder always inlines relativeurl()as data URI and has no such optionShould migration warn about it? Can add it here or in seperate PR