background
Recently, when I assisted the development of the project, I found that the project did not differentiate the environment. When I used mode to differentiate the environment, I found that the packaging result was completely different from the directory structure of vue-cli-service build when it was packaged by default.
vue-cli-service build
The default packaged directory structure looks like this
vue-cli-service build --mode test
Using the custom mode structure is like this (there are many JS files will not screenshot).
Look at the.env file that I set up earlier
The desired result
The packed file structure is the same as the default one
The solution
I found this sentence on vuecli website
So I added NODE_ENV = ‘production’ to the. Env file
The generated file is the same as the default file. The problem is resolved.