There is a special Webpack plugin for splitting out NgModules from your project. The easiest way is to just use the Angular CLI, which has this baked in already. If you can't use the CLI, you could still create a basic project, eject that project (i.e. ng eject) and see how it's done in the ejected configuration file.