RC2: Urgent import problem with Webpack

Somehow Webpack messes up my code which was working with beta11.
It seems that it can’t handle circular dependencies: https://github.com/webpack/webpack/issues/1788
I’m guessing this is the problem with my app, as sometimes an import just returns undefined.
I still cannot upgrade to RC2 and stick with beta11.
Somehow i wonder if i will ever be able to upgrade to a RC Version.
Why not stick with browserify, everything was working fine…

Update:
It is really related to WebPack having problems with circular imports. (which have nothing to do with angular circular dependencies at runtime).
But it is a problem for my app and the way Ionic also works, here’s the problem:
I have a ActionCommands service that is used by many pages to execute common actions.
Inside the ActionCommands service i also have to include several pages for modals etc. to be opened upon triggering an action.
However these pages need again the ActionsCommands service to trigger further actions.
Here’s is the circularity with importing.
BUT: There is no circularity with runtime dependencies, because the Pages imported inside the ActionsCommands service are only used to create a modal out of it.

Solution needed:
Lazy import / create a modal from a page.
OR
Create a modal by a string e.g. the name of the page, so the page does not have to get imported (by webpack)

What are the suggestions. I guess this will be a huge problem. I have read the angular 2 router has some kind of lazy loading modules.

I think this is a fatal design flaw. Services should never interact with the view layer. They should fetch and distribute data.

Hi Rapropos,

i have 20 years experience in software engineering and architecture. I don’t think this is a problem. And we are in the angular frontend world (not backend, high level languages).
I would not take the word “service” to hard. You can also think of it as a controller, viewModel or whatever.

Let’s say you need a “Do you really want to save ?” Dialog in many many places. How would you do that ?

And the service actually isn’t “interacting”, it just creates a modal. The rest of the “view”-logic is in the controller for modal of course…

I’m sorry no one else hasn’t answered yet…
I will create an ugly workaround today (thank’s webpack)
Cheers,
Nick