如何在 Angular 9 项目中使用 amplify-authenticator 修复生产版本?
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.
我正在使用新的 Amplify UI Components for Angular,据我所知没有其他可以导入的东西。知道哪里出了问题吗?
请在声明 SignPageComponent
的同一个 NgModule
中导入 AmplifyUIAngularModule
。
AOT(提前)编译器按顺序解析 NgModules。
原来我忘了把SigninPage
本身放到模块里了。将它添加到 declarations
解决了这个问题。不知道应用程序如何能够 运行 使用 JIT 编译器...♂️
我正在构建我的版本如下:
ionic cordova build android --prod --release
只有在删除 --prod
参数后,我假设配置文件才开始工作。
我有一个使用 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.
我正在使用新的 Amplify UI Components for Angular,据我所知没有其他可以导入的东西。知道哪里出了问题吗?
请在声明 SignPageComponent
的同一个 NgModule
中导入 AmplifyUIAngularModule
。
AOT(提前)编译器按顺序解析 NgModules。
原来我忘了把SigninPage
本身放到模块里了。将它添加到 declarations
解决了这个问题。不知道应用程序如何能够 运行 使用 JIT 编译器...♂️
我正在构建我的版本如下:
ionic cordova build android --prod --release
只有在删除 --prod
参数后,我假设配置文件才开始工作。