Prerequisites
Ionic Framework Version
v8.x
Current Behavior
Using @ionic/react together with react-router generates errors:
[vite] Internal server error: Directory import '/workspace/my-spa-app/node_modules/@ionic/core/components' is not supported resolving ES modules imported from /workspace/my-spa-app/node_modules/@ionic/react/dist/index.js
Did you mean to import "@ionic/core/components/index.js"?
Expected Behavior
No error :-)
Steps to Reproduce
npx create-react-router@latest my-spa-app
cd my-spa-app
npm i @ionic/react
cd app and edit root.tsx, add import { IonApp, setupIonicReact } from "@ionic/react"; invoke the setupIonicReact and wrap your template with IonApp
- Now go back to project root and
npm run dev.
Code Reproduction URL
https://github.com/jschill/react-router-ionic-issue
Ionic Info
Not using the cli in this project, i just want the ui components. But this is my ionic info:
Ionic:
Ionic CLI : 5.4.16
Utility:
cordova-res : not installed
native-run : not installed
System:
NodeJS : v22.14.0
npm : 11.2.0
OS : macOS Unknown
────────────────────────────────────────────────────────────
Ionic CLI update available: 5.4.16 → 7.2.0
The package name has changed from ionic to @ionic/cli!
To update, run: npm uninstall -g ionic
Then run: npm i -g @ionic/cli
────────────────────────────────────────────────────────────
Additional Information
Node 22.x