[solved] how webpack automatically compiles and packages vui-cli projects

Business background

  • develop Wechat official account through vue-cli webpack template
  • because to call the official account API, you must configure the request domain name url , such as example.com .
  • and this domain name must be configured in the official account backend legitimate business domain name
  • when I do not adjust the Wechat interface, I can test it through localhost .
  • but when it comes to api such as WeChat Pay or Wechat Map , you must upload the code to example.com for testing
  • .

problem description

  • this is very troublesome. Every time you modify the code and need to be tested, you must go through the following steps

    1. modify the code
    2. compile the package file npm run build
    3. upload packaged files to the server via ftp

question

  • is there any way to make npm run build execute automatically
  • means to package files automatically when they change, similar to npm run dev
  • .
  • it"s even better to upload ftp automatically after compilation
  • .

my attempt

  • probably knows that you want to set watch
  • but I haven"t configured the webpack file, so I haven"t worked it out for half an hour. Let"s ask a question
  • .
Apr.03,2021

you can use proxy to forward localhost/api/ to example.com/
proxyTable of devServer can be configured in development environment
forwarding rules of nginx, tomcat and other servers can be configured in formal environment


this is not clear in one sentence or two, and it is difficult for me to understand your project more clearly. Let me give you some advice.

for ftp upload, please refer to what I wrote: https://github.com/azl3979858.

.

for automation, please refer to what I wrote: https://github.com/azl3979858.

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37654-2c075.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37654-2c075.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?