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?

1 Answer 1

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/"
Sign up to request clarification or add additional context in comments.

1 Comment

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 (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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.