I'm following instructions from https://angular.io/guide/aot-compiler to get an AOT build.
As per the Bootstrap section, you need to switch your main.ts from this:
import { AppModule } from './app.module';
platformBrowserDynamic().bootstrapModule(AppModule);
to this:
import '../aot/App/app.module.ngfactory';
platformBrowserDynamic().bootstrapModule(AppModuleNgFactory);
But, after switching, when i run the ngc
compiler, I get this error:
Error: Command failed: C:\Windows\system32\cmd.exe /s /c "ngc -p tsconfig-aot.json"
TypeError: base64 is not a function
at Function.from (native)
at Function.from (native)
at Object.extractInlineSourceMap (E:\myapp\Sources\Web\node_modules\tsickle\build\src\source_map_utils.js:33:19)
at TsickleCompilerHost.stripAndStoreExistingSourceMap (E:\myapp\Sources\Web\node_modules\tsickle\build\src\tsickle_compiler_host.js:128:48)
at TsickleCompilerHost.getSourceFile (E:\myapp\Sources\Web\node_modules\tsickle\build\src\tsickle_compiler_host.js:89:25)
at findSourceFile (E:\myapp\Sources\Web\node_modules\typescript\lib\typescript.js:67909:29)
at processImportedModules (E:\myapp\Sources\Web\node_modules\typescript\lib\typescript.js:68056:25)
at findSourceFile (E:\myapp\Sources\Web\node_modules\typescript\lib\typescript.js:67937:17)
at processSourceFile (E:\myapp\Sources\Web\node_modules\typescript\lib\typescript.js:67840:27)
at processRootFile (E:\myapp\Sources\Web\node_modules\typescript\lib\typescript.js:67728:13)
Compilation failed
at ChildProcess.exithandler (child_process.js:213:12)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:821:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
I know about the "Base64 is not a function error in Node.JS 5.3 and below" problem, but I'm using NodeJS v8.2.1.