refactor(angular): make standalone imports default#31217
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
ShaneK
left a comment
There was a problem hiding this comment.
Awesome work! Just a few problems below, but I also noticed a couple of other problems outside the diff scope:
- BREAKING.md wasn't updated, and it definitely should be for this. This is a massive breaking change. Worth a migration note: @ionic/angular/standalone becomes @ionic/angular, and @ionic/angular becomes @ionic/angular/lazy. The existing Module Resolution section also uses @ionic/angular/standalone as its example subpath (BREAKING.md:203), which no longer exists after this change.
- The Project Structure section in packages/angular/README.md (lines 96-114) is now stale. It still describes a src submodule imported from @ionic/angular and standalone imported from @ionic/angular/standalone, both reversed and renamed now.
| return addRootProvider( | ||
| projectName, | ||
| ({ code, external }) => code`${external('provideIonicAngular', '@ionic/angular/standalone')}({})` | ||
| ({ code, external }) => code`${external('provideIonicAngular', '@ionic/angular')}({})` |
There was a problem hiding this comment.
You updated this path to @ionic/angular, but the sibling NgModule path got missed. addIonicModuleImportToNgModule in schematics/utils/ast.ts:27 still does insertImport(..., 'IonicModule', '@ionic/angular'), and after this PR IonicModule only lives in @ionic/angular/lazy (the standalone default @ionic/angular doesn't export it). So ng add @ionic/angular on an NgModule app, the branch that runs when app.module.ts exists, generates an import that won't compile. That line should pull IonicModule from @ionic/angular/lazy. CI doesn't catch it because ng add isn't run against a generated app.
What is the current behavior?
The default path for imports is
@ionic/angularand imports the lazy-loaded angular components.@ionic/angular/standaloneimports the standalone components.What is the new behavior?
The default path,
@ionic/angular, imports standalone components. Lazy-loaded components are imported from@ionic/angular/lazy.Does this introduce a breaking change?
Applications that use lazy-loaded angular components will need to update their import paths from
@ionic/angularto@ionic/angular/lazy.Applications that use standalone angular components will need to update their import paths from
@ionic/angular/standaloneto@ionic/angular.Other information
Ionic starters will need their import paths updated to match these changes.