ligershark / CoreTemplatePack

A collection of .NET Core project templates
Other
82 stars 17 forks source link

Project.json has the entire node_modules directory published #10

Open latchkostov opened 7 years ago

latchkostov commented 7 years ago

After using this template successfully and deploying to IIS, I realized that the upload to my server was ~100MB. 99% of that bulk was due to the node_modules being included in the publish.

"publishOptions": {
    "include": [
      "appsettings.json",
      "ClientApp/dist",
      "node_modules",
      "Views",
      "web.config",
      "wwwroot"
    ]
  },

I am not sure if this directory actually needs to be included. But if not, taking that out would be ideal.

SteveSandersonMS commented 7 years ago

It does need to be included if you're using a file-based deployment method (VSTS, or maybe just FTP), because node_modules does have to be present on the server for server-side prerendering to run.

However, if your deployment mechanism automatically does an npm install for you (e.g., when deploying via Git to Azure), then you don't need to include node_modules because the deployment system will recreate it on the server.

So, it does need to be in the template for people using VSTS/FTP/etc.