Vue does not specify js for packing

Copyright notice: This article is originally published BY the blogger. It follows the COPYRIGHT agreement CC 4.0 BY-SA. Please attach the link of the original source and this statement. Link to this article: blog.csdn.net/qq_32858649…

Solution:

Import with the script tag in index.html as shown below

 <script src="<%= BASE_URL %>api/api.js"></script>
Copy the code

Key points:

You must refer to the way favicon.ico is referenced.

Add variable parameters to your current reference path, vue variable parameters vary according to the version, I am vue cli3 variable parameters are:

 <%= BASE_URL %>
Copy the code

If you do not do this, you may enter the page without problems, but after refreshing the page you may find that your JS load order may change after ajax functions cause variables to undenfind, so be careful.

I haven’t found a better way for Vue to package specific JS yet. This is a good one.