isDevMode/enableProdMode错误:平台设置后无法启用产品模式 [英] isDevMode / enableProdMode error :Cannot enable prod mode after platform setup

查看:321
本文介绍了isDevMode/enableProdMode错误:平台设置后无法启用产品模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚将我们的项目升级到Angular 4.1.0.这还包括将webpack升级到2.2.1,以及将ngx-boostrap升级到1.9.2,以及其他软件包升级.

I have just upgraded our project to Angular 4.1.0. This also included upgrading webpack to 2.2.1, and upgrading ngx-boostrap to 1.9.2 amongst other package upgrades.

所有这些升级后,我在开发模式下使用webpack开发服务器测试了所有内容,一切都很好.然后,我尝试了生产webpack的构建.构建工作正常,但是在运行我们的网站时,我立即收到错误消息平台设置后无法启用产品模式".

After upgrading all this, I tested everything with webpack dev server, in dev mode and all was fine. I then tried a production webpack build. The build worked fine, but upon running our site I immediately get the error 'Cannot enable prod mode after platform setup'.

使用Chrome开发工具进行调查后,我发现ngx-bootstrap/utils/warn-once.js在启动过程中正在调用isDevMode().这发生在main.ts中调用enableProdMode()之前.角度代码不允许在检查后更改模式,因此会引发错误.我理解那部分.

Having investigated using Chrome dev tools, I can see that ngx-bootstrap/utils/warn-once.js is calling isDevMode() during startup. This happens before the call to enableProdMode() in our main.ts. The angular code doesn't allow the mode to be changed after it has been checked, so throws the error. That part I understand.

但是,我对webpack的了解远不止于使它适用于我们的项目.我不知道这是怎么回事.是吗?

However, my knowledge of webpack goes as far as having it work for our project and no further. I have no idea what is at fault here. Is it:

1)ngx-bootstrap启动时不应调用isDevMode().

1) That ngx-bootstrap shouldn't be calling isDevMode() as it starts up.

2)我的webpack配置不正确,并且在运行main.ts之后应该发生对isDevMode的调用(但是,我们的任何代码都没有更改,因为在升级之前,所有代码都工作正常).

2) That I have webpack configured incorrectly, and the call to isDevMode should be happening after main.ts is run (however none any of our code has changed since this was all working fine before the upgrade).

3)还有其他东西

很抱歉,这是一个模糊的问题.我只是对webpack不够了解,无法更准确地询问它.任何帮助将不胜感激.

Apologies that this is a vague question. I just don't have enough understanding of webpack to ask it more accurately. Any help would be much appreciated.

谢谢

推荐答案

将ngx-bootstrap更新为1.9.3,此版本已解决了该问题.

Update ngx-bootstrap to 1.9.3, this release has fixed that issue.

这篇关于isDevMode/enableProdMode错误:平台设置后无法启用产品模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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