错误:无法在 --prod 中确定类 OverlayPortal 的模块 [英] Error: Cannot determine the module for class OverlayPortal in --prod

查看:21
本文介绍了错误:无法在 --prod 中确定类 OverlayPortal 的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定我是否只面临 ionic cordova run android --prod 的问题,而我的 ionic cordova run android 工作正常.

i am not sure i am facing an issue only with ionic cordova run android --prod and my ionic cordova run android works fine.

错误:

Error: Cannot determine the module for class OverlayPortal in /Users/gopi/Documents/bos/hybrid-app/node_modules/ionic-angular/es2015/components/app/overlay-portal.d.ts! Add OverlayPortal to the NgModule to fix it.
Cannot determine the module for class IonicApp in /Users/gopi/Documents/bos/hybrid-app/node_modules/ionic-angular/es2015/components/app/app-root.d.ts! Add IonicApp to the NgModule to fix it.
Cannot determine the module for class ClickBlock in /Users/gopi/Documents/bos/hybrid-app/node_modules/ionic-angular/es2015/components/app/click-block.d.ts! Add ClickBlock to the NgModule to fix it.
Cannot determine the module for class Slides in /Users/gopi/Documents/bos/hybrid-app/node_modules/ionic-angular/es2015/components/slides/slides.d.ts! Add Slides to the NgModule to fix it.

谁能给我解释清楚:

这是我的离子信息

cli 包:(/usr/local/lib/node_modules)

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

全局包:

Cordova CLI : 7.0.1

本地包:

@ionic/app-scripts : 1.3.8
Cordova Platforms  : android 6.2.3 ios 4.4.0
Ionic Framework    : ionic-angular 3.4.2

系统:

Android SDK Tools : 25.2.5
Node              : v6.11.1
npm               : 3.10.10
OS                : macOS Sierra
Xcode             : Xcode 8.3.2 Build version 8E2002

推荐答案

我终于找到了解决这个问题的方法.我从 ionic-angular 导入了一些直接导入嵌套组件的导入,而不是从顶级包导出导入.我猜 prod AOT 编译器不喜欢从顶级导入一些导入,而一些直接导入到嵌套项.下面是我的一个例子.我的猜测是您可以选择其中任何一种方法,但是当混合使用它们时,AOT 编译器会不高兴.

I finally found a fix for this. I had a few imports from ionic-angular that imported the nested component directly as opposed to importing from the top-level package export. I'm guessing the prod AOT compiler didn't like having some imports from the top-level and some directly to the nested item. An example for me is below. My guess is you could choose either one of these approaches, but when mixing them the AOT compiler won't be happy.

从 'ionic-angular' 导入 { LoadingController };

不好

import { LoadingController } from 'ionic-angular/components/loading/loading-controller';

这篇关于错误:无法在 --prod 中确定类 OverlayPortal 的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆