Wednesday, November 28, 2018

Angular base paths and the Angular CLI

In an Angular application, defining the base path such that it is a folder deeper than the root immediately below the domain name may be wise. Confidence that a production environment will not mandate that the application be tucked into a folder may be foolish.

 
 

ng build --base-href /YOURNAMEHERE/

...will modifiy the base path via the Angular CLI.

 
 

ng build --bh /YOURNAMEHERE/

...is also legit. A base HTML tag sets the base path ultimately beyond all of the contortions above. Strange errors which may appear at the console in Google Chrome Developer Tools due to a bad setting with this stuff include:

  • Refused to apply style from ' http://www.example.com/yin/yang.css ' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
  • Uncaught ReferenceError: System is not defined

No comments:

Post a Comment