angular-schule/angular-cli-ghpages

CORS error when requesting dist files from goDaddy.

alphatier826 opened this issue · 7 comments

image

The above image shows the CORS issue while my custom domain website tries to consume dist files from GitHub ghPage.
Below is the command I use after pushing the code in GitHub -

ng build --prod --base-href "github_project_path" --source-map --build-optimizer

ngh --dir dist/AHMv2

The custom domain configuration is also getting success.
image

When you run the app at the root of your domain there is no need to set the base-href to a different value.
Can you please post the exact build command?
Can you access the bundle files directly in the browser?
Please also check whether the bundles are correctly pushed to the repo. If this happens, the problem is beyond the scope of this lib.

@fmalcher
When you run the app at the root of your domain there is no need to set the base-href to a different value - Let me try with this.

Can you please post the exact build command -
ng build --prod --base-href "https://alphatier826.github.io/almighty/"

Can you access the bundle files directly in the browser?
Yes

Please also check whether the bundles are correctly pushed to the repo. If this happens, the problem is beyond the scope of this lib.
Please PFA and you can access the below repo.
image

https://github.com/alphatier826/almighty/tree/gh-pages

@fmalcher
I ran the command without base-href, and it's throwing the error.

ng build --prod "https://alphatier826.github.io/almighty/"
image

The command makes no sense now. 😅 You removed the base-href param but not its value. Just create a prod build without any reference to the GitHub repo.

Btw, if somehow possible, I recommend to use the builder version of this library.

Closing this for now as it's not an issue related to the library itself.

@fmalcher
What does this mean "I recommend to use the builder version of this library.", please send me some refrence of this.Or any video clip.

The README explains all of it in detail. We provide a deployment builder that can be used directly from the Angular CLI. It does build and deployment in one command so there's less confusion about the exact two commands needed.

Thanks, It worked. @fmalcher Hidden Superheroes.