angular-cli工具的--base-href和--deploy-url参数之间有什么区别 [英] What's the difference between --base-href and --deploy-url parameters of angular-cli tool

查看:776
本文介绍了angular-cli工具的--base-href和--deploy-url参数之间有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Angular的文档通知我,当将其部署在服务器的子文件夹中时,应该在Angular应用程序构建中使用--base-href参数进行生产:

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

如果将文件复制到服务器子文件夹中,请附加build标志, --base-href并适当设置<base href>.

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

例如,如果index.html在服务器上的/my/app/index.html, 像这样将基本href设置为<base href="/my/app/">.

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

但是,angular-cli具有--deploy-url参数.该工具的文档将其描述为:

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

将在其中部署文件的URL.

URL where files will be deployed.

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

当应用程序要部署在服务器的子文件夹中时,我已经看到了使用--base-href--deploy-url插入的解决方案.

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

angular-cli工具的--base-href--deploy-url参数之间有什么区别?我应该何时使用每个?

What's the difference between --base-href and --deploy-url parameters of angular-cli tool? When should I use each one?

推荐答案

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆