2

To deploy my angular app on server, I run the following command: ng build --prod. But in the dist folder that I get, I don't have the index.html file. I wonder if it is a best practice to copy and paste the index.html file that I have or if there is something else that i am missing.

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
    }
  }
}
11
  • The build was OK or did it fail? Commented Jul 17, 2017 at 9:58
  • The build is ok. No error is shown in the console Commented Jul 17, 2017 at 9:59
  • @edkeveked ng build --prod should have index.html. check your angular-cli.json and under app there shoul be index key Commented Jul 17, 2017 at 11:12
  • @NikhilRadadiya what should I check in the angular-cli.json file? Commented Jul 17, 2017 at 11:22
  • @edkeveked post your angular-cli.json here Commented Jul 17, 2017 at 11:22

1 Answer 1

1

This line
"outDir": "../../target/frontend", suggests that your code is being generated in target\frontend folder and not in dist folder. If you want to change it to dist. change that line to "outDir": "dist", from "outDir": "../../target/frontend",

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.