I created a application using Angular CLI and it works fine with the JIT compilation. I felt i need to make my application much faster so I planned to convert the application from JIT to AOT.
I followed the instructions which is being mentioned by angular.io
https://angular.io/guide/aot-compiler
This documentation.
I successfully converted steps which helps us to convert all files into ngFactory , did completed rollup process with no error.
I am getting error when i perform ng build --aot
The error message is as following
Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options. Error: Tried to find bootstrap code, but could not. Specify either statically analyzable bootstrap code or pass in an entryModule to the plugins options. at Object.resolveEntryModuleFromMain (/Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/@ngtools/webpack/src/entry_resolver.js:128:11) at AotPlugin._setupOptions (/Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/@ngtools/webpack/src/plugin.js:143:50) at new AotPlugin (/Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/@ngtools/webpack/src/plugin.js:26:14) at _createAotPlugin (/Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/@angular/cli/models/webpack-configs/typescript.js:55:12) at Object.exports.getAotConfig (/Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/@angular/cli/models/webpack-configs/typescript.js:88:19) at NgCliWebpackConfig.buildConfig (/Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/@angular/cli/models/webpack-config.js:26:37) at Class.run (/Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/@angular/cli/tasks/build.js:27:92) at Class.run (/Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/@angular/cli/commands/build.js:149:26) at Class.Command.validateAndRun (/Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/@angular/cli/ember-cli/lib/models/command.js:128:15) at /Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:92:22 at tryCatch (/Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/rsvp/dist/rsvp.js:539:12) at invokeCallback (/Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/rsvp/dist/rsvp.js:554:13) at /Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/rsvp/dist/rsvp.js:629:16 at flush (/Users/wakdev/WebstormProjects/wak_ang2_angcli/node_modules/rsvp/dist/rsvp.js:2414:5) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)
here is my main.ts
import { platformBrowser } from '@angular/platform-browser';
import {AppModuleNgFactory} from '../aot/src/app/app.module.ngfactory';
console.log('Running AOT compiled');
//platformServer().bootstrapModuleFactory(AppModuleNgFactory);
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
my tsconfig-aot.json
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": ["es2015", "dom"],
"noImplicitAny": false,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"./node_modules/@types/"
]
},
"files": [
"src/app/app.module.ts",
"src/main.ts",
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : true
}
}
Does anyone has the same issue