When using vue webpack to build a single-page application, there are several issues that are not clear.
1. How to handle user authorization and login status?
2. Are cookies no longer useful in single-page applications?
3. In the dist directory compiled by webpack, can the index.html and static files in it be run directly with nginx?
4. Is there any detailed webpack information? The official website generally only explains the meaning of each configuration but does not demonstrate it. Many configuration items can only be read but not understood or used
The main doubt currently lies in the first question, I hope God can answer it
1 + 2: After all, the maintenance of login status is nothing more than letting the client get a token that represents your login session after logging in. If you can get this, you will understand that it can actually be done by various means. It’s just one of the implementation options. So the key to this is that you handle the login well, and after logging in, the server registers a new token and issues the token to the client. As for the storage on the client side, it depends on your implementation, cookie / localStorage is fine, or you can simply use js variables to maintain it (if you don’t mind losing the state after refreshing)
3 - Yes, but if you use historyState, then configure try_files (or/and rewrite) so that the URLs are processed correctly
4 - This question is too general, search the documentation if needed