Build Configuration
• Angular CLI: Done!
• ngtools/webpack
• Webpack
• ngtools/webpack
• Big thanks to the CLI-Team
• Or: angular-router-loader
• Big thanks to Brandon Roberts
Page ▪ 9
Slide 10
Slide 10 text
Two Sides
of a Coin
Slide 11
Slide 11 text
Lazy Loading
• Lazy Loading means: Loading it later
• Better startup performance
• Delay during execution for loading on demand
Slide 12
Slide 12 text
Preloading
Page ▪ 12
Slide 13
Slide 13 text
Idea
• Modules that might be needed later are loaded after (!) the
start of the application
• When the module is actually needed, it is available
immediately
Page ▪ 13
Lazy Loading and Shared Modules
Page ▪ 18
AppModule
FlightModule
SharedModule
includes
includes
(lazy)
includes
AuthService
Slide 18
Slide 18 text
Lazy Loading and Shared Modules
Page ▪ 19
AppModule
FlightModule
SharedModule
includes
includes
(lazy)
includes
AuthService
AuthService
Slide 19
Slide 19 text
Lazy Loading and Shared Modules
Page ▪ 20
AppModule
FlightModule
SharedModule
includes
includes
(lazy)
includes
AuthService
AuthService
Slide 20
Slide 20 text
Solution
Page ▪ 21
AppModule
FlightModule
SharedModule
includes
(lazy)
CoreModule
includes
includes
Only import CoreModule into AppModule!
Global Providers like AuthService
Slide 21
Slide 21 text
Huge CoreModule?
Page ▪ 22
AppModule
FlightModule
SharedModule
includes
(lazy)
CoreModule
includes
includes
Slide 22
Slide 22 text
Solution (for Libraries)
Page ▪ 23
AppModule
FlightModule
AuthModule
includes
(lazy)
CoreModule
includes
Slide 23
Slide 23 text
Solution (for Libraries)
Page ▪ 24
AppModule
FlightModule
AuthModule
includes
(lazy)
includes (with Services)
CoreModule
includes
includes
(without Services)