I am working on creating a Nuxt SPA
with routing and possibly an API in the future. The plan is as follows:
- A backend server (using
express
or similar) will listen for requests and serve the entire SPA to the client. - Once loaded, the user can interact with everything on the client side, including routing, without needing additional requests to the backend (unless it's for API calls).
This setup requires the server to provide an .html
file along with necessary js
and css
files to make the SPA work on the client side.
I have tried running commands like nuxt build
and nuxt generate
, but encountered issues where the js
files could not be found.
In addition, the index.html
file did not function properly.
After some research, I came across a potential solution.
However, I now face another problem depicted in this https://i.sstatic.net/8A3V8.png
The issue lies in the inability to open the fourth js
file from within another js
file due to incorrect paths! More details can be seen here: https://i.sstatic.net/7W6WI.png
Despite various attempts to run it as a static html
file from localhost (including using Live Server), the problem persists.
I believe there must be a more straightforward built-in function or feature that enables us to achieve what I aim for.
If my explanation is unclear or if you spot any mistakes, please feel free to ask for clarification. Any assistance would be greatly appreciated!