[SOLVED] Page imported outside of app.module.ts is undefiend

Because of the recent generator change my project was left with half lazy loaded half regular pages, which interacted weirdly with the navigation changes, so I decided to just remove lazy loading altogether.
To help with the change I created a pages.ts file that reexports all the pages, and then later realized I could make it a module, import the modules generated for the lazy ones and declare the non-lazy pages there.
But I got hit with an Unexpected value 'undefined' declared by the module 'PagesModule'. So I checked and it’s the non-lazy page that’s undefined.
If I move the import to app.module.ts and add to declarations there it works, but not in pages.ts. I even tried recreating the module.ts files copying the old generated files, but that didn’t help either.

What am I doing wrong here?

EDIT: The reason was that I had circlular dependencies.