9

This question is related to Angular2+ (not AngularJS)

We are trying to host our angular site under a virtual directory under a website on IIS.

We have a Website Called Development that points to: C:\inetpub\wwwroot\Development. In this folder we have another folder called Web. This Web folder holds the angular site code (built with ng build --base-href "/Web" --deploy-url "/Web"

When we navigate to http://server/Web, everything seems to be loading fine, except for the 0.chuck.js file. For some reason this file is being requested as:

http://server/Web0.chuck.jsenter image description here

It seems like the "/" is missing before the 0, but I'm not sure where this setting could be handled.

Any ideas?

Newteq Developer
  • 2,257
  • 1
  • 26
  • 32

1 Answers1

13

The url change is handled by webpack. This is controlled by the --deploy-url.

Running the following fixes it:

ng build --base-href "/Web" --deploy-url "/Web/"
Newteq Developer
  • 2,257
  • 1
  • 26
  • 32
  • Yes, this will work for all versions of angular2+ (we were actually on angular 4 when I created the question, I'll update the question to reflect) - unless a new version of angular uses a different cli. See this link for more information on ng build (https://github.com/angular/angular-cli/wiki/build). Basically this ng build comes down to how the index.html file is stitched up with the provided params. – Newteq Developer Aug 03 '18 at 09:13