In the package. The json
"scripts": {
"buildmode": "vue-cli-service build --modern",},Copy the code
Using this command to package the project, the project will be packaged in “modern mode”, which will essentially pack two packages, but looks the same as the general DIST, and will automatically choose whether to use the new or old syntax version for the user based on the browser version. The downside is that there are essentially two packages, so packages get bigger
"browserslist": [
"last 26 Chrome versions"
]
Copy the code
Babel needs compatible versions of the browser. Babel does syntacular translation when compiling according to our Settings here
You can go to the project folder in Ubuntu and type the NPX browserslist command to see the currently packaged Babel default compatible browser version
In principle, the modern model is recommended
This allows users with newer browsers to use a compiled version of the new syntax
In either case, Babel does not translate the new syntax in the plug-in
Babel 7.x has added the ability to manually set the coverage. You can set the coverage to the entire project root directory and convert the syntax in the plug-in at the same time, so who knows how to set this?