ngrx / core

Core functionality for the ngrx platform
MIT License
72 stars 25 forks source link

UMD bundle unsuitable because other libs deep-import #9

Closed kylecordes closed 8 years ago

kylecordes commented 8 years ago

Last night's new version of store and core include UMD bundles in the box. That's great, but there is a problem.

Store, as I write this, in the very first line of https://github.com/ngrx/store/blob/master/src/store.ts performs a deep import from core.

This runs into the exact same problem, when you try to actually use the UMD bundles, as we have seen with RxJS + UMD + SystemJS: the combination of UMD and the system loader is unable to "see" deep imports in a UMD. This problem was also present in Angular itself for quite a while, until numerous Angular source files were changed such that the various sub libraries import from each other at the top level only. Since the published RxJS API makes extensive use of deep imports, the solution there has been to just not attempt to use RxJS with system and UMD..

Possible solutions for NgRx:

I have been doing the latter, but it is an ugly hack I think... And that means I'm still making my own bundle of store instead of using the shiny new one in the box.

(Of course this only affects those neural cases where people care about loading all these libraries via UMDs. Demo apps. Plunkers. Training material, that one is my use case.)

kylecordes commented 8 years ago

Update from @MikeRyan52 : Core already exports the select stuff at the top - Store can be made to use that.

I think that means there is no problem to solve any further from the "core" side. Things can be fixed by making store use the new top-level export.