How to deploy node_modules folder to production server?

Viewed 10744

I making a very simple website (like pastebin) in PHP (LAMP server). This site uses jquery and bootstrap. I was using bower earlier, but I want to switch to using npm instead.

My directory structure is like this:

  • public
    • html
      • index.php
      • node_modules
        • jquery
          • dist
            • jquery.js
          • plus dozens of needless folders
        • bootstrap
          • ...

When I was using bower, I used to upload the whole bower_components folder to my FTP server. My node_modules folder is pretty large and contains hundreds of files and so I'm not sure if I should be uploading it?

I guess I can just upload package.json and run npm install on the command line of my webserver after uploading, but will exposing node_modules folder to the public pose potential security risks?

1 Answers
Related