question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

remove Option "deployUrl" is deprecated warning

See original GitHub issue

I add this issue again. Before someone close it (again), please answer this - https://stackoverflow.com/q/71548735/2896495. How should I make the dist to have scripts point to the right folder (ngxapp):

<script src="/ngxapp/runtime.js" type="module"></script>

I use the following command to build my angular app and publish it with a back-end made using .NET:

ng build --base-href /%folder% --deploy-url /%folder%/ --configuration=production

And it’s a bit annoying to see this warning:

Option “deployUrl” is deprecated: Use “baseHref” option, “APP_BASE_HREF” DI token or a combination of both instead. For more information, see https://angular.io/guide/deployment#the-deploy-url.

There’s no way deployUrl is deprecated. Please remove this warning.

OS: Windows 11

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:17

github_iconTop GitHub Comments

3reactions
jkapongocommented, Sep 3, 2022

@alan-agius4 with the deprecation of deployUrl what’s your suggested workaround for SSR applications? The entire application can not be on a CDN, albeit, it’s better that the assets be hosted on a CDN.

Deprecating deployUrl simply because it decreases the build speed, while leaving out an important edge case does not seem quite fitting. My suggestion would be to leave the option and not recommend it for most cases. The trade-off in increased build times for faster assets delivery can be worth it.

1reaction
webmutationcommented, Aug 24, 2022

Thanks Alan, so if I understood correctly the proposed solution we have to overwrite the value of base href with the APP_BASE_HREF Token, but will that not affect as well the loading of the elements?

Our elements are distributed as part of the assets folder /assets/elements/remote-el-xyz

ng b --base-href=“http://cdn-url.com/” { provide: APP_BASE_HREF, useValue: ‘/myapp’ }

Our host app is merely a shell all the modules are elements that get dynamically loaded.

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>MyApp</title>
    <base href="/myapp">
    <script type="text/javascript" src="https://authenticationserver.org/scripts/login.js"></script>
    <script type="text/javascript" src="https://distname.cloudfront.net/assets/jsrsasign-all-min.js"></script>
    <script type="text/javascript" src="https://distname.cloudfront.net/assets/oidc-client.min.js"></script>
    <script type="text/javascript" src="https://distname.cloudfront.net/assets/openid-login.js"></script>
    <script type="text/javascript" src="https://distname.cloudfront.net/assets/openid-new-to-old-bridge.js"></script>
    <script type="text/javascript" src="https://distname.cloudfront.net/assets/server-push-notifications.js"></script>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="icon" type="image/x-icon" href="favicon.ico">
<link rel="stylesheet" href="https://distname.cloudfront.net/styles.5af8e51e1c0c5aae9789.css"></head>
<body>
<app-root>
    <div id="loader-wrapper">
        <div id="loader"></div>
    </div>
</app-root>
<script src="https://distname.cloudfront.net/runtime.3f28f2d9ca9eec616215.js" defer></script><script src="https://distname.cloudfront.net/polyfills.93988ca94e854fb4f2cd.js" defer></script><script src="https://distname.cloudfront.net/scripts.ff911464c874173a42fd.js" defer></script><script src="https://distname.cloudfront.net/main.3a229c16b3069358894e.js" defer></script></body>
</html>

We are not able to to host fully on CDN due to data protection policy for the API calls to not leave the DC, static assets are fine, no sensitive data, but backend calls contain sensitive data, hence the use of the reverse proxy.

The previous syntax seemed more obvious, base-href for app, deploy-url for assets, clear separation of concerns. Now it will require additional insight to understand what APP_BASE_HREF does.

In any case, thank you for the proposed solution we will try and see if we hit any hickups.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is best way to go about replacing 'deployUrl' in angular ...
Option "deployUrl" is deprecated: Use "baseHref" option, "APP_BASE_HREF" DI token or a combination of both instead. For more information, see ...
Read more >
Deprecated APIs and features - Angular
This section contains a complete list all of the currently deprecated CLI flags. @angular-devkit/build-angularlink. API/Option, May be removed in, Details ...
Read more >
ng serve - Angular
Option Description Value Type Default Value ‑‑hmr Enable hot module replacement. boolean false ‑‑host Host to listen on. string localhost ‑‑open Opens the url in default...
Read more >
Removed or deprecated platform features | Dynamics 365
This article describes features that have been removed, or that are planned for removal in platform updates of finance and operations apps.
Read more >
ng build - Angular
Delete the output path before building. Default: true. --deployUrl= deployUrl. URL where files will be deployed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found