Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename index.html will lead that the app is not available #3748

Closed
MienDev opened this issue Dec 27, 2016 · 6 comments · Fixed by #3813
Closed

rename index.html will lead that the app is not available #3748

MienDev opened this issue Dec 27, 2016 · 6 comments · Fixed by #3813

Comments

@MienDev
Copy link

MienDev commented Dec 27, 2016

IMHO, the index file for the app is configurable, and a file named such as main.html can be used if the value for index in angular-cli.json is given.
however, rename index.html file will lead that the app is not available after I upgrade the angular-cli to beta.24. (while working well in beta.18)


OS?

windows 10

Versions.

angular-cli: 1.0.0-beta.24
node: 6.5.0
os: win32 x64
@angular/common: 2.4.1
@angular/compiler: 2.4.1
@angular/compiler-cli: 2.4.1
@angular/core: 2.4.1
@angular/forms: 2.4.1
@angular/http: 2.4.1
@angular/platform-browser: 2.4.1
@angular/platform-browser-dynamic: 2.4.1
@angular/platform-server: 2.4.1
@angular/router: 3.4.1

Repro steps.

  1. ng init ( npm install)
  2. rename file index.html to main.html
  3. change the value of index key to main.html
  4. ng serve (build ok)
  5. visit the default url (http://localhost:4200)
  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "main.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"
      }
    }
  ]

The log given by the failure.

page shows "Cannot GET /"
http status code is "404"

Mention any other details that might be useful.

when switch angular-cli to version beta.18, everything goes smoothly.


@MienDev MienDev changed the title index config for default index file in angular-cli.json takes no effect. rename index.html will lead that the app is not available Dec 28, 2016
@Besendorfer
Copy link

Besendorfer commented Dec 30, 2016

I'm also having this issue.

@filipesilva
Copy link
Contributor

Older versions had the output hardcoded to always be index.html, but we fixed that in #2767. If you use a different name for index, it will be output with that name. That is by design.

@Besendorfer
Copy link

I think the issue is that if you change the name of index.html to be something else, webpack-dev-server doesn't recognize that the new .html/.htm file should be served instead.

For example, I changed the name to be default.htm, went to http://localhost:4200, and received the error "Cannot GET /". Going to http://localhost:4200/default.htm works just fine though. So the server isn't recognizing the change. Is this desired behavior?

@MienDev
Copy link
Author

MienDev commented Jan 1, 2017

@Besendorfer yeah, exactly, that is what I wanna to say.

@filipesilva Maybe, you misunderstand this issue, also plz refer to @Besendorfer 's words.

Issue can be easily reproduced by steps provided.

@filipesilva
Copy link
Contributor

Ok I understand better now. I understood the reproduction but mostly thought that it was ok that you'd go manually to http://localhost:4200/default.htm yourself, since you changed it.

But defaulting to a particular file is important, especially for refreshes.

@filipesilva filipesilva reopened this Jan 1, 2017
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Jan 1, 2017
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Jan 3, 2017
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Jan 3, 2017
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Jan 3, 2017
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Jan 3, 2017
filipesilva added a commit to filipesilva/angular-cli that referenced this issue Jan 4, 2017
MRHarrison pushed a commit to MRHarrison/angular-cli that referenced this issue Feb 9, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants