Skip to content

refactor(angular): make standalone imports default#31217

Open
OS-jacobbell wants to merge 6 commits into
major-9.0from
FW-7273
Open

refactor(angular): make standalone imports default#31217
OS-jacobbell wants to merge 6 commits into
major-9.0from
FW-7273

Conversation

@OS-jacobbell

Copy link
Copy Markdown
Contributor

What is the current behavior?

The default path for imports is @ionic/angular and imports the lazy-loaded angular components. @ionic/angular/standalone imports 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?

  • Yes
  • No

Applications that use lazy-loaded angular components will need to update their import paths from @ionic/angular to @ionic/angular/lazy.
Applications that use standalone angular components will need to update their import paths from @ionic/angular/standalone to @ionic/angular.

Other information

Ionic starters will need their import paths updated to match these changes.

@OS-jacobbell OS-jacobbell requested a review from a team as a code owner June 15, 2026 20:15
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment Jun 18, 2026 2:30pm

Request Review

@github-actions github-actions Bot added package: core @ionic/core package package: angular @ionic/angular package labels Jun 15, 2026
@OS-jacobbell OS-jacobbell changed the title Fw 7273 refactor(angular): make standalone imports default Jun 17, 2026

@ShaneK ShaneK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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')}({})`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: angular @ionic/angular package package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants