Search code examples
angularangular-climqttangular7production-environment

Angular CLI doesn't include all packages on ng build --prod


I'm done Angular 7 Project and when i load on server debug version ( ng build ), everythings works. But in production ( ng build --prod) the mqtt included doesn't works.

So i used https://www.npmjs.com/package/paho-mqtt this plugin.

And when i run ng build normally, and i load the dist, works on server. But if i use ng build --prod the paho mqtt doesn't works, on the same server. Works only in ng build Why ?

Sorry but i'm newer of Angular and i didn't understand why don't works.


Solution

  • Glad you got it working.

    Basically:

    1) Delete your node_modules folder

    2) Make sure you installed and saved it npm i paho-mqtt --save

    This will ensure the package wasnt cached incorrectly and install it as a dependency.