Angular ng build --target=production giving errors

喜欢而已 提交于 2019-12-03 20:37:31

Are your email and password properties defined to be private? Are they used in the component's template? Then they need to be changed from private to public.

When you use the Angular CLI's production mode, you automatically get the following:

  • --aot is set to true
  • --output-hashing is set to all (fingerprints assets)
  • --sourcemaps is set to false
  • --extract-css is set to true (makes real css files for global styles, while dev makes .js files as a rebuild optimization)
  • adds service worker if configured in the CLI json
  • replaces process.env.NODE_ENV in modules with the production value (this is needed for some libs, like react)
  • runs uglify on the code

See this for more information: https://github.com/angular/angular-cli/pull/6232

It is the aot compiler that is most likely generating these errors. The aot compiler compiles the template in TypeScript and hence generates more type errors. So another alternative is to use the --prod without aot.

You cloud try to set public visibility on email and password.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!