How to compile vue-cli in real time with the background?

my problem now is that this index needs to be used on the background Tomcat
, but the js files and static files needed for this index are all in the dist (webpack packaged directory
so if I want to compile the files in src now, how can they be compiled into dist files in real time?
it is impossible to npm run build a little bit of code. Isn"t that too much trouble? Do you need to configure something when compiling?
what I want now is that when I start the eclipse, I can modify the files in the src and the js in the dist directory can also be changed in real time.
I hope someone who has studied can give me a method.


if you want to use background data, you can use npm run dev to start the local service, and then use the agent to process the link requesting api. Refer to the link http://vuejs-templates.github.. If you really need real-time compilation, you can learn about nodemon , for example, you can configure scripts:

in package.json.
"scripts": {
    "start": "nodemon --watch src -e html,vue,js,less build/build.js"
  },

-- watch turns on monitoring mode, monitors the src folder, and-e configures the monitored file types (html, vue, js, less), build/build.js are the scripts you want to run. So you can compile

in real time with npm run start on the command line.

webpack-- watch-- config. / build/webpack.prod.conf.js


vue-cli 3.0 comes with watch parameter
you can directly add -- watch

to package.json .
 "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build  --watch",
    "lint": "vue-cli-service lint"
  },

clipboard.png


webpack-- watch Ah, -- watch parameter is the


npm run dev automatically compiled to monitor file changes, so that what you see in the locally started service is what you have modified and will change in real time. npm run build is usually packaged when it is last uploaded to the server.


has the subject found a way?

Menu