一般都用Angular CLI的 ng server去host
但突然想要用 Apache
1. ng new YourProj
2. set build/output directory(option)
// in angular-cli.json
// outDir 可以設定build/output的資料夾,預設是dist
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"styles.css"
],
"scripts": [],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
3.use relative path
// in index.html
//
base href="./"
4.ng build --prod
bulid完就會出現dist資料夾
然後把dist資料夾移到apache的路徑下就ok了
沒有留言:
張貼留言