Skip to content

chore(angular): test schematics and code-splitting - #31401

Open
OS-jacobbell wants to merge 16 commits into
mainfrom
FW-7692
Open

chore(angular): test schematics and code-splitting#31401
OS-jacobbell wants to merge 16 commits into
mainfrom
FW-7692

Conversation

@OS-jacobbell

@OS-jacobbell OS-jacobbell commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Issue number: internal


What is the new behavior?

  • New test project for validating Ionic components are split across chunks with the new per-component exports.
  • Script for testing schematics.
  • More exports from the standalone barrel file in package.json.
  • CI step for running packages/angular tests.

Does this introduce a breaking change?

  • Yes
  • No

@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
ionic-framework Ready Ready Preview Sep 1, 2026 5:42pm UTC

Request Review

@github-actions github-actions Bot added the package: angular @ionic/angular package label Aug 24, 2026
Comment thread packages/angular/scripts/test-code-split.js Fixed

@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.

Glad to see this, it's the test I was after on the exports PR. Two big things I noticed though, the export type move breaks IonicSafeString at runtime, and neither new test fails yet on what it's protecting. There's some other things worth looking at too though, and some nits.

Comment thread packages/angular/src/standalone/index.ts
Comment thread packages/angular/scripts/test-code-split.js Outdated
Comment thread packages/angular/test/code-split/src/main.ts Outdated
Comment thread packages/angular/package.json Outdated
Comment thread packages/angular/scripts/verify-schematics.js
Comment thread packages/angular/scripts/test-code-split.js Outdated
Comment thread packages/angular/package.json Outdated
Comment thread .github/workflows/actions/build-angular/action.yml Outdated
Comment thread packages/angular/test/code-split/src/app/home/home.page.spec.ts Outdated
Comment thread packages/angular/scripts/verify-exports.js Outdated
Comment thread packages/angular/scripts/test-code-split.js Fixed

@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.

Getting close! The job split and the new build step in the schematics test are both good additions.

Two bigger ones this round. The codemod corrupts any import that has a comment in it, and the code-split assertion still passes when a component ends up in main.js. I built the fixture to check both. There are replies on the older threads too, including a couple where you were right and I wasn't.

Comment thread packages/angular/scripts/migrate-per-component-imports.js Outdated
Comment thread packages/angular/scripts/migrate-per-component-imports.js Outdated
Comment thread .github/workflows/actions/test-angular-package/action.yml
Comment thread .github/workflows/actions/test-angular-package/action.yml Outdated
Comment thread .github/workflows/actions/test-angular-e2e/action.yml Outdated
Comment thread packages/angular/test/code-split/src/main.ts Outdated
@OS-jacobbell
OS-jacobbell requested a review from a team as a code owner September 1, 2026 13:24
@OS-jacobbell
OS-jacobbell requested a review from thetaPC September 1, 2026 13:24

@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.

Looks good to me, great work! Everything from the last two rounds checks out. One small thing left on the code-split check, up to you whether that goes here or whatever

execSync(`npm run build`, { cwd: PROJECT_DIR, stdio: 'inherit' });

const stats = fs.readJsonSync(STATS_FILE);
const chunks = findChunksForPage(stats, 'landing.page.ts');

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.

The closure rewrite works. Both regressions fail against it now: importing IonToggle eagerly into AppComponent exits 1, and putting main.ts back on a barrel import of IonicRouteStrategy does too. You were right that main.js needs no special case, it's already in the closure.

The header half of last round's check didn't make it in though, and without it this can pass having measured nothing. When no output matches, findChunksForPage returns an empty Set and the script prints its success line and exits 0. I renamed landing.page.ts to landing.view.ts, fixed the route import and reran it: green, exit 0, nothing checked. Could you assert ion-header is in the closure alongside the toggle check? I confirmed it's in there, so it should pass as is.

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

Labels

package: angular @ionic/angular package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants