How VUE JS is not packaged

how VUE JS is not packaged

for example:
has a public domain name, and I put JS in the static folder
clipboard.png

after Npm run build, change the domain name in the packaged dist folder, and it will not work

the question is: how to set or configure, directly change the domain name in the JS directory of the packaged dist file, and take effect directly, without having to package every time

Mar.22,2021

it must be useful to change dist directly, so you might as well send out how you changed it.

in addition, configurations such as request addresses are best made that can be directly modified by the outside world, such as obtaining them through the interface, or setting them with cookie/localStorage

.

1. If you import variables through import, they have already been typed into the project code as constant resources at the time of packaging, so it will not work if you modify them directly.
2. A stupid method is to directly introduce variables in this js,js through index.html to declare variables directly through var. However, you should pay attention to naming conflicts, and there is an error in the variable "not defined" when packaging. Although it does not affect the use, obsessive-compulsive disorder may cause headaches (^ _ ^).
3. The front and background code of my project is under the same project, so I omit the domain name of the request address and access it through / project name / interface address, so that all packages can be used. The most important point is that the front and background are under the same project.
4, other methods are also being studied, but I haven't thought of it yet.


finally, create a js, that executes the function immediately, contains global variables, and then directly introduces them in index.html, and uses global variables directly elsewhere. Package and launch, or you can directly take effect on this js change

Menu