Vue webpack packages "Cannot read property 'call' of undefined"

For the project written by

vue-cli, the local test will not appear. After uploading to the server, you will sometimes report an error on the page

.

clipboard.png
vendor.jsmanifest.js

clipboard.png
an error will be reported if the request occurs as shown in the figure above. The preliminary estimate is due to the cache, because the three js of manifest,vendor,app need to be loaded sequentially. If vendor is loaded twice, it will report an error

.

We have tried to solve the problem, that is, after packing the package, modify it in the index file under the dist folder. It was originally like this

.
<script type=text/javascript src=/home_stay/static/js/manifest.6e0c0240c920e78b4f21.js></script>
<script type=text/javascript src=/home_stay/static/js/vendor.5f1b9e59bd38bb0d30c7.js></script>
<script type=text/javascript src=/home_stay/static/js/app.fa4b495fc2bb6f1e6120.js></script></script></body></html>

the modified figure is as follows

<script>
          document.write(`<script type=text/javascript src=/home_stay/static/js/manifest.6e0c0240c920e78b4f21.js?`+Math.random()+`><\/script>;<script type=text/javascript src=/home_stay/static/js/vendor.5f1b9e59bd38bb0d30c7.js?`+Math.random()+`><\/script>;<script type=text/javascript src=/home_stay/static/js/app.fa4b495fc2bb6f1e6120.js?`+Math.random()+`><\/script>;`)
        </script>

that is, add random numbers to the three packaged js (manifest,vendor,app), do not use caching, and reload each time.
it is true that there is no error in doing so, but there are two new problems
. First, you have to reload every time. Users will not use the cache after entering, so the loading speed will be slow and consume traffic.
the second is that every time you modify or update the project, you have to package it and then modify it, which is very troublesome and a bit opportunistic.

so I"d like to ask if there is any good way to solve this problem. Thank you.

Mar.04,2021
Menu