This is a simple example on how to achieve ahead of time compilation with Angular2 using Webpack 2 and the AotPlugin for Webpack. There's also an example of how to achive async module loading. For a complete skeleton of Angular2 (with Webpack 2, lazy loading, AOT), use my fork of angular2-webpack-starter.
npm install
npm start
http://localhost:3000/
npm install
npm run build
Open dist/
- The AotPlugin is not a requirement. It makes it easier to use. The command line can also be used.
- You need to add
angularCompilerOptions
section to the tsconfig.json and specify the entry module - Add the AotPlugin to Webpack config and add
@ngtools/webpack
as rule for .ts files