Vue-cli introduces third-party non-modular js

beginners, initialize the project with vue-cli and webpack,
now want to introduce a non-modular js file,
this file has the following characteristics:

  1. wants to make global references, such as the js file in the css library
  2. there is no need to modify it
  3. itself is only written in the original js file, and it is not in the npm library

searched for related problems and carried out a small amount of practice. The simplest method is to introduce it directly into the index.html file in the traditional way, which can be used globally, but this will lead to the check of eslint

.

other ways, such as webpack"s external, but I didn"t find the so-called webpack.config.js file. I don"t know what to do.
there are also some methods that use jquery as an example, but jquery can be installed through npm, and it only has a function name of $, which is special and doesn"t seem to be applicable.

want a good way to introduce third-party non-modular js files into it.


1. It's good to introduce it into index.html. Eslint can be turned off. Those who use eslint are really good-tempered

the external of 2.webpack is usually in webpack.config.js under the root of the project, or in webpack.base.conf.js under the build folder

3. In the entry file (index.js): import'. Your file path is also fine


https://www.jianshu.com/p/f6e.
refer to


https://blog.csdn.net/adenfen.

Menu