How to manage node_modules folder based on build type (dev/prod)


  • Hi, 

    New to nodejs. Building node.js lambda function in AWS. When debugging locally, I need to include aws-sdk but once I deploy, aws provides the aws-sdk module so I don't need to include it in the node_modules folder I upload to AWS. 

    I'm using VS2015.3 and my package.json looks like this:

      "name": "CreateStackLF",
      "version": "1.0.0",
      "description": "Implements 'createStack' method",
      "main": "CreateStackLF.js",
      "devDependencies": {
        "aws-sdk": "^2.4.7",
        "babel-core": "^6.10.4"
      "dependencies": {
        "bluebird": "^3.4.0",
        "querystring": "^0.2.0"
      "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
      "author": ""

    Ideally when I set the VS 'Solution Configuration' to 'Debug', and do a build, I would like node_modules to contain both the dependent and devDependant modules, but then when I change the configuration to 'Release', followed by 'Clean' followed by Build' I would like the node_modules to only contain the 'dependent' modules. 

    Is this natively supported by VS? If not, are there any extensions (i did a search but did not find anything) and lastly, if not, it seems like I could code this with grunt or gulp but have not used before so can you point me to any good tutorials so I can get started quickly

    Thursday, July 14, 2016 5:21 PM


  • Hi skellish,

    I didn't find the solution using the solution configuration, but maybe you could think about using the NPM as a workaround.

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, July 18, 2016 4:28 AM