I just upgraded our project to Angular 4.1.0. This also included updating webpack to version 2.2.1 and updating ngx-boostrap to 1.9.2 among other package updates.
After updating all this, I tested everything with the webpack dev server, in dev mode, and everything was fine. Then I tried building webpack for production. The design worked fine, but after launching our site, I immediately received the error message "Unable to enable prod mode after setting up the platform."
After examining the Chrome dev tools, I can see that ngx-bootstrap / utils / warn-once.js calls isDevMode () at startup. This happens before calling enableProdMode () in our main.ts. Angular code does not allow you to change the mode after checking it, so it throws an error. I understand this part.
However, my knowledge of webpack goes so far as to work for our project, and not further. I have no idea what is to blame. It:
1) So that ngx-bootstrap does not call isDevMode () at startup.
2). I did not configure webpack correctly, and the isDevMode call should be executed after main.ts was launched (however, none of our codes changed, since all this worked fine before the update).
3) Something else
Sorry that this is a vague question. I just don’t have enough understanding of webpack to ask it more precisely. Any help would be greatly appreciated.
thank