I have an Angular 7 app that's been happily using ngx-bootstrap
. Now that I've tried to publish the app after a while, I am getting the errors below. If I just use the app in development mode, all is well. I am using Visual Studio for development and publishing but I can reproduce this just using the CLI. Apparently, ng serve
works just fine while ng serve --prod
gives me the errors below (stripped for clarity). This is all related to bsDaterangepicker
.
Khronos locale error: please load locale "en" before using it
(anonymous) @ main.f09bc86ef36b4bf3b010.js:1
main.f09bc86ef36b4bf3b010.js:1 ERROR Error: Uncaught (in promise): Error: Locale "en" is not defined, please add it with "defineLocale(...)"
Error: Locale "en" is not defined, please add it with "defineLocale(...)"
at e.writeValue (main.f09bc86ef36b4bf3b010.js:1)
main.f09bc86ef36b4bf3b010.js:1 Khronos locale error: please load locale "en" before using it
I have found a SO question that I thought could help me workaround the problem but that did not work.
I have tried going back a few revisions of my package.json
but that didn't seem to help. It seems as if Angular production build optimizations are making a mess. And just as I was getting ready to post the question, I tried ng serve --prod --optimization=false
which seems to fix the issue. But apparently, that's not ideal. Is this something one can hope will be fixed in the upcoming Angular versions?
it looks like a bug (so there is no real solution to it), and it has been reported here:
https://github.com/valor-software/ngx-bootstrap/issues/4752
possible workarounds until it is solved:
buildOptimizer
to falseEDIT: the issue has been solved, so the solution is simply update your ngx-bootstrap to the latest version available