What's the difference between --base-href and --deploy-url parameters of angular-cli tool Ask Question

What's the difference between --base-href and --deploy-url parameters of angular-cli tool Ask Question

The documentation of Angular informs one should use --base-href parameter in the Angular application build for production when it's going to be deployed in a subfolder:

If you copy the files into a server sub-folder, append the build flag, --base-href and set the <base href> appropriately.

For example, if the index.html is on the server at /my/app/index.html, set the base href to <base href="/my/app/"> like this.

https://angular.io/guide/deployment

However, the angular-cli has the --deploy-url parameter. The documentation of the tool describes it as:

URL where files will be deployed.

https://github.com/angular/angular-cli/wiki/build

I have seen solutions that use the --deploy-url instead of --base-href when the application is going to be deployed in a subfolder.

#The question#

--base-hrefangular-cli ツールのとパラメータの違いは何ですか--deploy-url? それぞれいつ使用すればよいですか?

ベストアンサー1

  • ベース hrefルーティングによって使用されている
  • デプロイURL資産用です。

ほとんどの場合、base-href で十分です。

以下の投稿をご覧ください:

おすすめ記事