繁体   English   中英

如何在 Angular 9 项目中使用放大验证器修复生产构建?

[英]How to fix production build with amplify-authenticator in Angular 9 project?

我有一个使用 Angular 9 的项目,该项目具有<amplify-authenticator>元素,并在项目的单个模块中从@aws-amplify/ui-angular导入AmplifyUIAngularModule 它在开发构建中运行良好,但是当我尝试进行生产构建时,它失败了:

ERROR in src/app/signin/signin.page.html:13:5 - error NG8001: 'amplify-authenticator' is not a known element:
1. If 'amplify-authenticator' is an Angular component, then verify that it is part of this module.
2. If 'amplify-authenticator' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.

13     <amplify-authenticator [handleAuthStateChange]="handleAuthStateChange">
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  src/app/signin/signin.page.ts:7:18
    7     templateUrl: 'signin.page.html',
                       ~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component SigninPage.

我正在为 Angular 使用新的 Amplify UI 组件,所以据我所知,没有其他东西可以导入。 有什么想法可能会出错吗?

请在声明SignPageComponent的同一个NgModule中导入AmplifyUIAngularModule

AOT(提前)编译器按顺序解析 NgModules。

原来我忘记将SigninPage本身放入模块中。 将它添加到declarations中解决了这个问题。 不知道应用程序如何能够使用 JIT 编译器运行...♂️

我正在按如下方式构建我的版本:

ionic cordova build android --prod --release

只有在删除--prod参数后,我假设配置文件才开始工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM