How to access the website of the root directory of the vue project?

problem description

I built a vue project locally with wepack, and I found that if you access static resources through port 8080, you can only access the contents of the static file under the vue project.

the environmental background of the problems and what methods you have tried

A month ago, I also built a vue project in the company, and put a test.txt, in the root directory that can be accessed through http://localhost:8080/test.txt. Why can"t the current vue project directly visit http://localhost:8080/test.txt to access test.txt? in the root directory of the vue project

what result do you expect? What is the error message actually seen?

I want to notify http://localhost:8080/a/b to access my files. This problem is not related to the version. I use the latest version, and vue has not installed router,. The same is true for me to reinstall a vue project.

Mar.31,2021

in principle, the static directory should be copied by webpack during construction, so you can access it directly. If other files are not under static, you need to manually copy them to the target directory generated by the build after webpack is built. Of course, you can also copy them for you by modifying the webpack script.

as to why you can do it a month ago and not a month later, maybe there have been some changes in the scripts of the two projects, you can compare the directories of the two projects to see what the differences are, and learn how to modify the build scripts by the way.

Menu