我有一个使用Angular 9的项目,该项目具有一个<amplify-authenticator>
元素,并且已经从AmplifyUIAngularModule
中的@aws-amplify/ui-angular
导入了该项目的单个模块中。它可以在开发版本中正常运行,但是当我尝试进行生产版本时,它会失败:
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.
我正在使用新的Amplify UI Components for Angular,据我所知,没有其他要导入的内容。任何想法可能出什么问题吗?
答案 0 :(得分:0)
请在声明AmplifyUIAngularModule
的同一NgModule
中导入SignPageComponent
。
AOT(提前)编译器按顺序解析NgModule。
答案 1 :(得分:0)
原来,我忘记了将SigninPage
本身放入模块中。将其添加到declarations
可以解决此问题。不知道该应用如何与JIT编译器一起运行... ??️
答案 2 :(得分:0)
我的发布版本如下:
ionic cordova build android --prod --release
仅在删除了--prod
参数后,我才假定配置文件开始起作用。