The "ng build" dist html file is compiling incorrectly
See original GitHub issuePlease go to the below link to StackOverflow and see the correct (green check marked) answer for a good explanation
http://stackoverflow.com/questions/37558656/angular-clis-ng-build-doesnt-produce-a-working-project
question title: “Angular CLi’s “ng build” doesn’t produce a working project?”
correct question answer:
change:
<base href="/">
to:
<base href="./">
Versions.
angular-cli 1.0.0 on Linux and macOSsierra, that I’m aware of.
Desired functionality.
should load angular js instead just loads html This appears to be a bug.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Error in production build: Index html generation failed [closed]
It occurs on generating the final index.html. This is a compilation error probably in the css/scss files (as the typescript seem to compile...
Read more >Identify and Fix Build and Deployment Errors in Your Angular ...
In this guide, you will learn how to spot some of the most common build and deployment errors and how to resolve them...
Read more >Deployment - Angular
On the first terminal, run the ng build command in watch mode to compile the application to the dist folder. ng build --watch....
Read more >Deploying an application - Angular
Deploying your application is the process of compiling, or building, your code and hosting the JavaScript, CSS, and HTML on a web server....
Read more >4 changes that help you improve your new Angular project
First thing that I noticed is that the build is not set to prod mode, and this can be changed with one simple...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Heya @filipesilva Thanks for your response sorry for any delay in my response, I didn’t see yours till just now. I’m not sure if what you’re saying is true for me or not. My localhost for test serving which has many sub folders works fine with
<base href="/">
but on my live web server which also has many sub folders<base href="./">
is required in order for things to serve properly. Perhaps this is because my live web server is a shared Linux server as opposed to a dedicated one, I’m not sure.Anyway my issue is cleared up now and I’m very happy with the angular-cli project so far. I know from my searches that I’m not the only one who has encountered this issue so hopefully this information helps someone else.
Heya @totallytotallyamazing, when you run
ng build
you get a bunch of file that you can deploy to a server.There’s a couple of things your server needs to do to server Angular apps however. We detail that in https://angular.io/docs/ts/latest/guide/deployment.html#!#server-configuration.
I don’t know the details of your server, but you might also need configure the base tag if you’re serving from a subfolder: https://angular.io/docs/ts/latest/guide/deployment.html#!#base-tag
Hope this helps!