Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Publishing Angular2SPA includes node_modules #429

Closed

Description

@MikeHook

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.

Activity

  1. MrCrimp commented on Nov 16, 2016

    @MrCrimp

    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.

  2. boban100janovski commented on Nov 17, 2016

    @boban100janovski

    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 😄)

  3. SteveSandersonMS commented on Nov 18, 2016

    @SteveSandersonMS
    Member

    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.

  4. MikeHook commented on Nov 18, 2016

    @MikeHook
    Author

    Thanks for clearing that up guys :)

  5. SteveSandersonMS commented on Dec 7, 2016

    @SteveSandersonMS
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions