4

I am trying to change the build path for react-app-rewired in the file config-overrides.json as mentioned here.

module.exports = {
    paths: function (paths, env) {
        paths.appBuild = 'C:\\Projects\\jhipster\\src\\main\\webapp\\app';
        return paths;
    }
};

But it is not taken into consideration, and I receive the following error:

Could not find a required file.
Name: index.html
Searched in: C:\Projects\jhipster\public

I have hardcoded the path directly just to test if it's working.

Am I omitting something?

McKinley
  • 1,123
  • 1
  • 8
  • 18
uzzi
  • 551
  • 2
  • 9
  • 29

1 Answers1

1

The problem actually isn't related to the build path. The problem is that React expects there to be a public/index.html file but can't find any such file. I'm guessing you've either renamed the public folder or moved index.html somewhere else.

Solution: tell react-app-rewired where to find index.html.

// config-overrides.json
module.exports = {
    paths: function (paths, env) {
        paths.appBuild = 'C:\\Projects\\jhipster\\src\\main\\webapp\\app';
        // Tell the app where our public folder is
        paths.appPublic = 'path_to_public_folder';
        // Tell the app where our index.html is
        path.appHtml = 'path_to_index.html';
        return paths;
    }
};
McKinley
  • 1,123
  • 1
  • 8
  • 18