Skip to content

feat(angular, react, vue): export additional core APIs - #31864

Merged
brandyscarney merged 6 commits into
feature-9.1from
FW-8032
Dec 4, 2026
Merged

brandyscarney merged 6 commits into
feature-9.1from
FW-8032

Conversation

@brandyscarney

@brandyscarney brandyscarney commented Dec 2, 2026 •

Copy link
Copy Markdown
Member

Issue number: internal


What is the current behavior?

The docs import several APIs from @ionic/core in Angular, React and Vue examples, such as getMode on the Config page, OverlayEventDetail in the modal examples, and setNonce from @ionic/core/loader in the security guide. The framework packages don't re-export them, and the install docs never say to add @ionic/core.

These imports only resolve because npm hoists the framework's @ionic/core dependency, so they fail with pnpm or Yarn PnP. Each framework package pins @ionic/core to an exact version when published, so adding it yourself at another version installs two copies.

What is the new behavior?

  • @ionic/react exports getMode, componentOnReady, menuController, setNonce, OverlayEventDetail, RangeValue and SelectInterface.
  • @ionic/vue exports getMode, componentOnReady, setNonce, OverlayEventDetail, RangeValue and SelectInterface. It already exported menuController.
  • @ionic/angular exports componentOnReady, setNonce, OverlayEventDetail, RangeValue and SelectInterface from both the standalone and lazy entry points. It doesn't export getMode or menuController, because Angular reads the mode through Config and has its own MenuController.
  • Tests in the React and Vue test apps check the new exports.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Dev build: 9.0.15-dev.11796247574.1ecbe59d

React's alertController is left out on purpose. The only docs page that imports it is the JavaScript-only ion-route page, and React apps use useIonAlert or IonAlert.

setNonce comes from the build each framework renders with. React, Vue and Angular standalone use @ionic/core/components, which has its own setNonce, so the security guide's @ionic/core/loader import doesn't apply to them. Angular lazy re-exports the loader's setNonce.

The docs examples will switch to importing from the framework package in a follow-up.

The docs import getMode, componentOnReady, OverlayEventDetail and other
APIs from @ionic/core in framework examples. Those imports only resolve
because npm hoists the framework's @ionic/core dependency, so they fail
with pnpm or Yarn PnP. Re-export them from each framework package.

- react: getMode, componentOnReady, menuController, OverlayEventDetail,
  RangeValue, SelectInterface
- vue: getMode, componentOnReady, OverlayEventDetail, RangeValue,
  SelectInterface
- angular (lazy and standalone): componentOnReady, OverlayEventDetail,
  RangeValue, SelectInterface

Angular reads the mode through Config and has its own MenuController,
so it does not export getMode or menuController.
@brandyscarney
brandyscarney requested a review from a team as a code owner December 2, 2026 20:24
@brandyscarney
brandyscarney requested a review from thetaPC December 2, 2026 20:24
@vercel

vercel Bot commented Dec 2, 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 Dec 4, 2026 9:47pm UTC

Request Review

@github-actions github-actions Bot added package: angular @ionic/angular package package: vue @ionic/vue package package: react @ionic/react package labels Dec 2, 2026
@brandyscarney
brandyscarney marked this pull request as draft December 2, 2026 20:33
The security guide imports setNonce from @ionic/core/loader. React, Vue
and Angular standalone render through @ionic/core/components, which has
its own setNonce. Re-export the one each framework uses: the components
build for React, Vue and Angular standalone, and the loader for Angular
lazy.

@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! Just one thing on the Vue test, since nothing there would catch the new types going missing.

Co-authored-by: Shane <561207+ShaneK@users.noreply.github.com>

@thetaPC thetaPC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, left non blockers

Comment on lines +1 to +3
import type { OverlayEventDetail, RangeValue, SelectInterface } from "./index";

export type CoreTypeExports = [OverlayEventDetail, RangeValue, SelectInterface];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since rollup.config.mjs gives the TypeScript plugin the whole tsconfig, this file ends up in the published package as dist/types/exports.type-test.d.ts. Excluding it in rollup.config.mjs keeps it out of dist, and npm run typecheck still checks it:

typescript({ exclude: ['**/*.type-test.ts'] }),

The pattern resolves from rootDir (src), so src/**/*.type-test.ts doesn't match.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks! Added your exclude in 339481b. The file is no longer in dist, and typecheck still catches a removed export.

Comment on lines +55 to +56
componentOnReady,
setNonce,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nothing in CI fails if one of these exports is dropped from @ionic/angular or @ionic/angular/standalone. verify-exports.js only checks the per-component entries in package.json, and the Angular test app doesn't import any of them.

The Angular docs examples will import OverlayEventDetail and the rest from here too, so please add a usage of componentOnReady, setNonce, OverlayEventDetail, RangeValue and SelectInterface to the test app, once under standalone and once under lazy. That way a removed export fails CI, the same way the Vue type-test file does.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good call! Added the five exports to the providers pages in both lazy and standalone in e6c1615, with a spec for each. Removing any of them now fails the test app build.

brandyscarney and others added 2 commits December 4, 2026 16:20
Co-authored-by: Maria Hutt <13530427+thetaPC@users.noreply.github.com>
@brandyscarney
brandyscarney merged commit 022d036 into feature-9.1 Dec 4, 2026
54 checks passed
@brandyscarney
brandyscarney deleted the FW-8032 branch December 4, 2026 22:09

This branch was successfully deployed

1 active deployment
Preview — ee694a49 Deployed Dec 4, 2026 by vercel[bot]
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: react @ionic/react package package: vue @ionic/vue package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants