2017-07-17 87 views
2

要在服务器上部署我的角应用程序,我运行以下命令:ng build --prod。但在我得到的dist文件夹中,我没有index.html文件。我想知道是否最好的做法是复制并粘贴我拥有的index.html文件,或者是否有其他我缺少的文件。在apache服务器上部署角应用程序

angular-cli.json

{ 
    "project": { 
    "version": "1.0.0-beta.28.3", 
    "name": "main" 
    }, 
    "apps": [ 
    { 
     "root": "src", 
     "outDir": "../../target/frontend", 
     "assets": [ 
     "assets", 
     "favicon.ico" 
     ], 
     "index": "index.html", 
     "main": "main.ts", 
     "polyfills": "polyfills.ts", 
     "test": "test.ts", 
     "tsconfig": "tsconfig.json", 
     "prefix": "app", 
     "styles": [ 
     "styles.css" 
     ], 
     "scripts": [], 
     "environmentSource": "environments/environment.ts", 
     "environments": { 
     "dev": "environments/environment.ts", 
     "prod": "environments/environment.prod.ts" 
     } 
    } 
    ], 
    "e2e": { 
    "protractor": { 
     "config": "./protractor.conf.js" 
    } 
    }, 
    "lint": [ 
    { 
     "files": "src/**/*.ts", 
     "project": "src/tsconfig.json" 
    }, 
    { 
     "files": "e2e/**/*.ts", 
     "project": "e2e/tsconfig.json" 
    } 
    ], 
    "test": { 
    "karma": { 
     "config": "./karma.conf.js" 
    } 
    }, 
    "defaults": { 
    "styleExt": "css", 
    "prefixInterfaces": false, 
    "inline": { 
     "style": false, 
     "template": false 
    }, 
    "spec": { 
     "class": false, 
     "component": true, 
     "directive": true, 
     "module": false, 
     "pipe": true, 
     "service": true 
    } 
    } 
} 
+0

构建正常或失败? – Henry

+0

构建是可以的。没有错误显示在控制台 – edkeveked

+0

@edkeveked'ng build --prod'应该有'index.html'。检查你的'angular-cli.json'和'app'下面有'index'键 –

回答

2

此行
"outDir": "../../target/frontend", 表明,在target\frontend文件夹中生成的代码,而不是在dist文件夹中。如果您想将其更改为dist。将该行更改为 "outDir": "dist", from "outDir": "../../target/frontend",

相关问题