Looking for a wizard in the world of Next.js to assist me with this query, or at least be straightforward and inform me if it is an impossible task.
We have a website that is compiled into static files. These files will be hosted on S3.
After running next export
, everything builds correctly. However, I had hoped to access subpages directly without needing to add the .html extension. I mistakenly assumed that Next would build pages into directories and place an index.html file in each directory.
The development setup is quite simple. Each component has its directory, for example, "some-component." Within this directory, there is an index.js file exporting the named component from an adjacent file like "some-component.js."
Everything works when starting at the root of the site - I can navigate to /components/some-component without worrying about the extension.
Next has indeed created a directory called some-component
, but the file inside it is still named some-component.html. Therefore, if you try to access that URL from your browser, it results in a 404 error.
Is there a way to make Next output index.html files into the directories so that browsing directly to the directory (try saying that after a drink) would work? Or am I pursuing the wrong path here?
I understand that there may be other solutions out there, especially for integrating with S3, but I thought it wouldn't hurt to ask about this specific approach.
Cheers!