You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
AFAIK the node_modules should not be needed as they are precompiled into the vendor.js file.
I removed them from my project by taking the folder out of the publishOptions include list in project.json. However the site only works then if the asp-prerender tag is also removed from the home page markup.
Also tried adding the aspnet-prerendering module to the webpack.config.vendor.js list but then the compiled javascript didn't run.
This is because the template you use is set up with server side rendering.
Unless I completely misunderstood how this works, node_modules is needed if you use server rendering (the asp-prerender tag) since this tag instructs the server to start a node.js process to do it's work before returning the resulting HTML to the client, where your client side javascript takes over. The node.js process needs node_modules to be present for this to work, it does'nt use your webpack bundles for it's internal work.
As @MrCrimp said "node_modules" folder is needed for pre-rendering, just remove the "asp-prerender-module" tag from the MVC view and it will work (as you already know 😄)
You are all correct - node_modules is needed if and only if you're doing server-side prerendering. Since that is on by default, that directory is also published by default.
Update: Deploying node_modules to production continues to cause trouble for people, so in the latest templates, we've eliminated the need to do that.
If you get the latest generator-aspnetspa-core and create a new project, you'll find its webpack config now builds a completely self-contained server-side prerendering bundle which never needs to reference node_modules at runtime. Therefore the default publishing config no longer includes node_modules at all.
Activity
MrCrimp commentedon Nov 16, 2016
This is because the template you use is set up with server side rendering.
Unless I completely misunderstood how this works, node_modules is needed if you use server rendering (the asp-prerender tag) since this tag instructs the server to start a node.js process to do it's work before returning the resulting HTML to the client, where your client side javascript takes over. The node.js process needs node_modules to be present for this to work, it does'nt use your webpack bundles for it's internal work.
boban100janovski commentedon Nov 17, 2016
As @MrCrimp said "node_modules" folder is needed for pre-rendering, just remove the "asp-prerender-module" tag from the MVC view and it will work (as you already know 😄)
SteveSandersonMS commentedon Nov 18, 2016
You are all correct -
node_modulesis needed if and only if you're doing server-side prerendering. Since that is on by default, that directory is also published by default.MikeHook commentedon Nov 18, 2016
Thanks for clearing that up guys :)
SteveSandersonMS commentedon Dec 7, 2016
Update: Deploying
node_modulesto production continues to cause trouble for people, so in the latest templates, we've eliminated the need to do that.If you get the latest
generator-aspnetspa-coreand create a new project, you'll find its webpack config now builds a completely self-contained server-side prerendering bundle which never needs to referencenode_modulesat runtime. Therefore the default publishing config no longer includesnode_modulesat all.