Skip to content

Provide useful messages for missing files #96

Closed
@gaearon

Description

@gaearon
  • index.html
  • favicon.ico
  • src/index.js

They are all required, and we should crash early with a descriptive message if they are not found.

(Probably we could make favicon optional but then it would be hard to guess where to put it. I see no harm in forcing it to be there since any real website needs it anyway.)

Activity

apoorvnandan

apoorvnandan commented on Jul 22, 2016

@apoorvnandan

Hey, I would like to work on this but I need some guidance. Will using npm file-exists before opening the browser do the job?

var fileExists = require('file-exists');
if (!fileExists("/index.html") || !fileExists("/favicon.ico") || !fileExists("/src/index.html")) {
  console.log("File missing");
}
else {
  console.log(chalk.cyan('Starting the development server...'));
  openBrowser();
}
gaearon

gaearon commented on Jul 22, 2016

@gaearon
ContributorAuthor

I would suggest to try implementing something that works and feels good. When we get the right UX we can choose to make changes to the actual implementation.

christophior

christophior commented on Jul 22, 2016

@christophior

Might take a look at this as well, I see that we already have paths that we're getting in the webpack configs so I was thinking of pulling those out since a lot of it seems like redundant data so that I could also use that in checking whether the required files exist.

vincaslt

vincaslt commented on Jul 22, 2016

@vincaslt

I guess something like that could work, tell me if it should be improved. Maybe move required file definitions to somewhat more manageable place?

delorge

delorge commented on Aug 3, 2016

@delorge

Is it easier to check that file exists via access check? Should work with any npm version. Moreover, no extra dependencies needed.

UPD: we can basically crash on errors and warn on missing favicon

gaearon

gaearon commented on Sep 18, 2016

@gaearon
ContributorAuthor

This should be fixed in 0.4.2.

added a commit that references this issue on Nov 18, 2017

Merge pull request facebook#96 from CADBOT/update-readme

locked and limited conversation to collaborators on Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @gaearon@vincaslt@christophior@apoorvnandan@delorge

        Issue actions

          Provide useful messages for missing files · Issue #96 · facebook/create-react-app