ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

fix(core): add an export map to import individual components

Open christian-bromann opened this issue 1 year ago • 5 comments
trafficstars

What is the current behavior?

The core package doesn't provide an export map, which prevents modern code bases to import specific components.

fixes #29716

What is the new behavior?

This patch contains:

  • a switch from node to bundler in the `moduleResolution field, both resolutions are very similar - changing this has no impact on the user as it is only for internal development
  • adding export entries for individual components to allow packages using modern module resolutions to import individual components

Does this introduce a breaking change?

  • [ ] Yes
  • [x] No

This should not impact users at all but enable them to use a different module resolution. However, I may not be too familiar how Ionic components are imported, therefor it would be good to do some thorough testing.

Other information

n/a

christian-bromann avatar Jul 16 '24 18:07 christian-bromann

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 17, 2024 6:16pm

vercel[bot] avatar Jul 16 '24 18:07 vercel[bot]

Thanks @sean-perkins for the feedback, I applied suggested improvements.

christian-bromann avatar Jul 16 '24 19:07 christian-bromann

@christian-bromann it looks like the docs.json still needs to be added to the package.json exports to resolve the Vue related build issues.

For the angular build issues/test issues, you should see this error:

Error: Module not found: Error: Package path ./loader

we should export the loader path as well for the lazy loaded distribution.

sean-perkins avatar Jul 17 '24 15:07 sean-perkins

~~Will this also fix the described code-splitting issue here https://github.com/ionic-team/ionic-framework/issues/28574 ? Sounds like with that change I am able to just use a component from one exported path instead of just @ionic/angular/standalone, right?~~ ok nvm I just tested removing fesm and export datetime explictly it does not change the build outcome or put datetime in a separate chunk file, guess its up to the bundlers... looking at you rspack.

muuvmuuv avatar Sep 26 '24 14:09 muuvmuuv

@christian-bromann what's the status of this PR?

thetaPC avatar May 23 '25 18:05 thetaPC