Angular-universal getting error: You must pass in a NgModule or NgModuleFactory to be bootstrapped

后端 未结 5 416
耶瑟儿~
耶瑟儿~ 2021-01-17 07:39

I converted my existing angular-cli application to angular-universal by following this guide.

You can look at my complete source code here.

I am able to buil

5条回答
  •  醉酒成梦
    2021-01-17 08:17

    Angular Ivy has changed the way server.ts performs bootstrapping. Basically, you have to run

    ng add @nguniversal/express-engine
    

    And then adjust your old SSR-related code in main.server.ts, server.ts/main.ts, tsconfig.server.json, app.server.module.ts towards the newly generated server.ts. Most probably the created server.ts will be placed in a different path, therefore don't forget to change the main path for server in angular.json.

提交回复
热议问题