In several tutorial videos on YouTube, I saw that in the process of website layout, the index.html file is located either in the root directory, or in the build / dist folder (the one for production).
The same GitHub Pages seems to be used to finding index.html in the root directory. And on hosting it seems the same (correct if I'm wrong). If it is located in the dist / build folder, will it be "found"?
What is the fundamental difference or, perhaps, the standard?
The index.html
has to be in the dist/
folder.
Because dist/
is usually generated by build-tools or bundlers and contains (generally speaking) the whole deployable project.
The generated index.html
contains paths to scripts and styles and other resources, that have been bundled and put into dist/
In the end you can build the dist/
and upload its content to a remote servers /var/www
and the website would be up and running.
Example with webpack:
npx webpack -p # -p for production mode
scp -r dist/* remote-server.com:/var/www/