Blogger Information
Blog 47
fans 0
comment 2
visits 102740
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
vue-cli打包后vendor.js文件太大
拾一枝樱花的博客
Original
1264 people have browsed it

下载 vue.min.js 放在 /static/ 目录下,并在 index.html 中引入 (或引入cdn路径也行)package.json 中配置的 vue 就不需要了,删掉/build/webpack.base.conf.js 文件中添加 vue 的映射module.exports = {
 externals: {    // '包名': '全局变量名'
   'vue': 'Vue'
 }
}

包名:即通过 npm install vue 时使用的名字
全局变量名:可建立一个html文件,script引入对应js,然后浏览器打开,在控制台输入包名,出现的智能提示即为全局变量名(若js文件较小,可直接粘贴到控制台,回车后在控制台输入包名,出现的智能提示即为全局变量名)


Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post