Reputation: 307
I have written a website in angular2 and deploy the dist folder ( after compiling using webpack) on the AWS server. website works just fine. Now I am wondering why ?? because I have not installed node.js on the server neither I have deployed the node_modules folder than how come the website works just fine. In my VS code, I have to download packages using npm but on server, no package exist. kindly explain. It may sound a strange question but I am really confused Or missing some basics.
Upvotes: 2
Views: 702
Reputation: 752
Below is the complete breakdown of files that are created after you run npm run build:prod:
Upvotes: 0
Reputation: 1874
Angular does not run on the server, but on the client instead.
The server simply sends the files to the client, so they can be run.
Therefore you really need nothing installed on the server. It is just there for delivery of the files.
EDIT: I guess it's worth mentioning that there is some tanspile/compile/pack steps that can happen on the server to make the distribution package readable
by the clients javascript.
Upvotes: 1
Reputation: 752
Actually when you are creating your distribution folder by running a command similar to npm run build:prod all your code including required packages and libraries are compressed into minified files which is eventually deployed to the server. So thats how all your node_modules are still part of your code in the dist folder.
Upvotes: 1