How to deploy node_modules folder to production server? [closed] How to deploy node_modules folder to production server? [closed] php php

How to deploy node_modules folder to production server? [closed]


Your node_modules folder should be in your .gitignore -if you are using git-. And no, you don't upload the whole folder. You, as you say, run npm install. This also applies to bower, you shouldn't upload the bower_components folder, you should run the command in your server.

As for the other part of the question, you shouldn't either expose node_modules. What you do is use some task manager or some bundler (gulp, grunt, webpack) and create a bundled (or concatted) version of your files (css and js). Once you have this file, that's what you expose. That's what you include in your index, for example <script src="dist/bundle.min.js"></script>