--deploy-url will have no effect on assets paths
Please provide us with the following information:
Versions.
Please run
ng --version. If there's nothing outputted, please run in a Terminal:node --versionand paste the result here:@angular/cli: 1.0.0-beta.30 node: 7.5.0 os: win32 x64 @angular/common: 2.4.6 @angular/compiler: 2.4.6 @angular/core: 2.4.6 @angular/forms: 2.4.6 @angular/http: 2.4.6 @angular/platform-browser: 2.4.6 @angular/platform-browser-dynamic: 2.4.6 @angular/router: 3.4.6 @angular/cli: 1.0.0-beta.30 @angular/compiler-cli: 2.4.6
Repro steps.
Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
- create app with the cli
- use
img src="assets/logo.png"in a template - ng build -d mysubfolder -bh mysubfolder
copy the content of the dist to "htdocs/mysubfolder" on any webserver or use
app.use('/mysubfolder', express.static(path.join(__dirname, angularDist)));on a node server.
The log given by the failure.
Normally this include a stack trace and some more information.
404 on all assets because it will ignore base href or deploy url and just use GET /assets/logo.png
Mention any other details that might be useful.
Hi, @clydin I have encountered the similar problem, Please help. angular-cli version:
Angular CLI: 6.2.5
Node: 8.12.0
OS: darwin x64
My deploy situation:
My site have to be deployed on server A because of domain, so I put index.html ( generated file in the dist folder) on server A. And I want to deploy all the static files on another CDN server B, and I put all the dist folder on Server B as a folder named like 111. I tried build my site with following ways:
way 1: Failed with some assets link in html did not converted to CDN path, so assets link in html breaks
ng build --prod --base-href /111/ --deploy-url https://B.com/111/
way 2: all the Angular router and http api both breaks, since all api and router are added with the base-href
ng build --prod --base-href https://B.com/111/
I have already set the APP_BASE_HREF token in src/app/app.module.ts:
@NgModule({
...
bootstrap: [AppComponent],
providers: [
{provide: APP_BASE_HREF, useValue: '/'}
]
})
Please help and let me know if you want more information. Thanks!
Assets in ts file is has no impact on deployUrl. I was trying dynamic configuration https://christianlydemann.com/implementing-dynamic-environments-in-angular-for-avoiding-one-build-per-environment/
public init() {
return from(
fetch('assets/app-config.json').then(function(response) {
return response.json();
})
).pipe(
map((config) => {
window.config = config;
return
})).toPromise();
}

Can anyone help me how deployUrl can be used to update references ts file?
Still we don't have any solution for the same issue. Don't know why this ticket is closed.
I am building my application on cnd server and serving my index.html file from other domain which is my public domain.
The build command for same is like ng build --prod --aot --output-hashing none --deploy-url=https://ng.xyzcdn.in/. If I am running my application on https://ng.xyzcdn.in/, static content are are coming from same cdn domain are fine. But when I am using my main/public domain to serve application, the static content path is relative to my main/public domain.
My requirement will be fixed only when static content would served via deploy url.
Note: All the chucks file are serving correctly via deploy url path on main/public domain. Only facing issue with static contents which are deployed inside "svg" and "assets" folders.
Application is not working fine when I am trying to hard code cdn path of "assets" in angular.json file.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.