After successfully creating an application using Angular CLI with JIT compilation, I decided to optimize its performance by converting it to AOT compilation.
Following the instructions provided on angular.io, I made the necessary changes to convert all files into ngFactory and completed the rollup process without any errors.
However, when running ng build --aot
, I encountered the following error:
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. // Error message details
Here is my main.ts file:
import { platformBrowser } from '@angular/platform-browser';
import {AppModuleNgFactory} from '../aot/src/app/app.module.ngfactory';
console.log('Running AOT compiled');
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);
And this is my tsconfig-aot.json configuration:
{
"compilerOptions": {
// Compiler Options details
},
"files": [
"src/app/app.module.ts",
"src/main.ts",
],
"angularCompilerOptions": {
// Angular Compiler Options details
}
}
Has anyone else faced a similar issue?