I know that I can use the angular-cli to config the deploy-url like --deploy-url http://xxxxxxx/
, but when I want to change the deploy-url I must to build again. I want to write somethings global like
md5-682323c7d1f21b18f4fca69483139f29
in the root html. And Can I set the deploy-url use the already exist variable when the app start so that I can change the url without build again?
I''m not sure that cli is aware about your html files. What you can do is to create a script which will update cli config with the correct value before the build.
Using deploy url at all should be unnecessary if all the deployed files are reachable at the ascribed http://xxxxxxx/
address.
I think this issue is a duplicate of https://github.com/angular/angular-cli/issues/3855. There are suggestions there on how you can setup runtime configuration.
@filipesilva I've read https://github.com/angular/angular-cli/issues/3855 all the way down, but I don't see where to assign deployUrl
, so my application will know where to fetch public resources from upon initializing on the page. This URL may change from page load to page load.
Maybe you can guide me here? As this issue was closed, but wasn't answered.
@wuzhouyang for make global deployUrl, You can add following code into your app section of Angular CLI file.
"apps": [
{
"deployUrl": "/path/",
}]
may this will help you.
I don’t know if anyone’s reading this topic before advising anything, but the main question is about “changing deployUrl” when app is already running (in runtime). Not on the stage of building app with angular-cli, as @RajnishKatharotiya @ctrl-brk are proposing.
I want to build once, deploy at multiple environments (assume the static files I'm serving from cdn/different domain and not from the same origin of index page)
I read you Kamilius!, I am also looking for a solution to this, since when deploying an Angular app to Salesforce as an apex page, the static assets locations are set dynamically at the time of deployment. And for Lazy Loading,... currently,... the --deploy-url
used to customize where to lazy load js chunks from.... _needs to be known_ at build time.
@filipesilva I believe this issue needs to be reopened as @ram-reddy said, when I need to implement build once and deploy in dev, test and prod the same build it is not possible now. This is a major issue when we develop an enterprise level application.
I read you Kamilius!, I am also looking for a solution to this, since when deploying an Angular app to Salesforce as an apex page, the static assets locations are set dynamically at the time of deployment. And for Lazy Loading,... currently,... the
--deploy-url
used to customize where to lazy load js chunks from.... _needs to be known_ at build time.
@david-salvador-wefox I managed to sort of 'hack' my way to a solution. Its not pretty but gets the job done.
On my Apex page i introduced a resourceUrl attribute to my app-root
\
Loading...\
then in my app.component file
declare let __webpack_public_path__;
__webpack_public_path__ = this.eleRef.nativeElement.getAttribute('resourceUrl'); + '/';
adding the trailing '/' to ensure appropriate relative path
This is not the best solution and I am still looking for a more elegant solution
I am also looking for better solution.
I read you Kamilius!, I am also looking for a solution to this, since when deploying an Angular app to Salesforce as an apex page, the static assets locations are set dynamically at the time of deployment. And for Lazy Loading,... currently,... the
--deploy-url
used to customize where to lazy load js chunks from.... _needs to be known_ at build time.@david-salvador-wefox I managed to sort of 'hack' my way to a solution. Its not pretty but gets the job done.
On my Apex page i introduced a resourceUrl attribute to my app-root
Loading... then in my app.component file
declare let __webpack_public_path__;
__webpack_public_path__ = this.eleRef.nativeElement.getAttribute('resourceUrl'); + '/';adding the trailing '/' to ensure appropriate relative path
This is not the best solution and I am still looking for a more elegant solution
I did the same and it works fine in development mode but doesn't work in production
Can this be re-opened? The linked issue is something different.
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._
Most helpful comment
I don’t know if anyone’s reading this topic before advising anything, but the main question is about “changing deployUrl” when app is already running (in runtime). Not on the stage of building app with angular-cli, as @RajnishKatharotiya @ctrl-brk are proposing.