Can someone explain which all modules are included in the build when each page is lazy loaded

When I run ionic serve , each main.js only contains the page.ts. But the production version build has ionicModule also included. And some modules which were eager loaded , are also included if I have imported them. Which doesnt happen in dev version build. Why is this happening? What is the structure of each main.js bundle with declarations and imports? Why is it different in dev and prod ? Something to do with AoT ?

You are talking about dev and prod - how are you building each one of these? Without the command you use, it will be hard to interpret what happens.

dev build by ionic serve and prod build by ionic run android - - prod