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

后端 未结 5 380
耶瑟儿~
耶瑟儿~ 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 07:57

    I checked out your repo and was able to view the dist fine without that error in the browser. Perhaps you forgot to add the flag -prod when running build? Please try this

    ng build --prod
    

    You can also remove the dist completely and/or remove node_modules, do npm cache clean, run npm install before trying to build again.

    If you are using npm scripts, I notice that your /server build is missing the --prod flag. Please try this

    "build:server": "ng build --prod --app 1 --output-hashing=false",
    

提交回复
热议问题