You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: Directory import ... is not supported resolving ES modules imported from ... Did you mean to import "@ionic/core/components/index.js"? #30686
I have searched for existing issues that already report this problem, without success.
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
changed the title [-]bug:[/-][+]bug: Directory import ... is not supported resolving ES modules imported from ... Did you mean to import "@ionic/core/components/index.js"?[/+]on Sep 19, 2025
When adding to an existing app, then @ionic/react-router should be used instead of react-router. We have a great guide on how to add Ionic to a React app that I recommend checking out.
If anyone else gets here who doesn't want to go down the @ionic/react-router-route because of the dependency on the quite old react router 5: I solved it by adding ssr.noExternal to my vite config. So my vite.config.ts ended up like this:
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Activity
[-]bug:[/-][+]bug: Directory import ... is not supported resolving ES modules imported from ... Did you mean to import "@ionic/core/components/index.js"?[/+]thetaPC commentedon Sep 26, 2025
Thank you for submitting the issue!
When adding to an existing app, then
@ionic/react-routershould be used instead ofreact-router. We have a great guide on how to add Ionic to a React app that I recommend checking out.jschill commentedon Oct 6, 2025
If anyone else gets here who doesn't want to go down the
@ionic/react-router-route because of the dependency on the quite old react router 5: I solved it by adding ssr.noExternal to my vite config. So my vite.config.ts ended up like this:ionitron-bot commentedon Nov 5, 2025
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
feat(core): add package exports map for ESM subpath resolution (#31180)