Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
606 views
in Technique[技术] by (71.8m points)

angular2 部署到服务器

现在我的问题是,我们打算多个项目部署到同一个服务器上。前端使用的是angular2框架,已经使用

ng build --prod -aot

打出包来了,但是因为是要多个项目部署的,那么打包出来的index里配置的<base href="/">使得图片、js、css文件都获取不到。现在我打算改成<base href="./">,那么我是不是要所有链接都要改,把js的链接改成./xxxx.js?
新手请教!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

假定某项目名叫 xxx,并且你会把 build 的文件夹也叫 xxx,那么试试:

ng build --prod --bh /xxx --op /xxx

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...