vue cli3配置多页面入口
2020-07-07 22:37
1041 查看
使用vue 配置多入口
因为懒,所以要提高开发效率,因为懒,所以要安装第三方依赖
- 使用glob自动加载
yarn add glob -D //安装依赖
- 配置vue.config.js
const getEntries =(pathUrl)=>{ let pages={} glob.sync(pathUrl).map(filePath=>{ const fileName=filePath.substring(filePath.lastIndexOf("/")+1,filePath.lastIndexOf(".")) pages[fileName]={ /* 返回对应的入口页面配置,详情见vue-cli官网 */ template: `${filePath.substring(0, filePath.lastIndexOf("."))}.html`, entry:filePath, filename: fileName+".html", chunks: ['manifest', 'chunk-vendors','chunk-common',fileName], title:fileName } }) console.log(pages) return pages } const entries = getEntries("src/entries/**/*.js") //入口文件夹位置 module.exports={ pages:entries,//配置多入口 }
相关文章推荐
- vue-cli
- Vue 实现腾讯新闻案例
- vue-devtools安装
- 如何用vue脚手架快速构建一个基于webpack管理的vue项目
- Vue.js中引入图片路径的几种方式
- vue组件页面高度根据屏幕大小自适应
- chrome浏览器手动安装vue-devtools插件
- vue 插槽
- VUE报错You are using the runtime-only build of Vue where the template compiler is not available
- 入坑Vue
- 搭建一个vue项目、vue项目各配置文件作用和个人vue项目开发总结
- vue中实现自动滚动表格
- vue element-UI后台管理系统学习笔记(一)
- VUE 如何覆盖element组件样式
- vue蒙版 滚动事件穿透解决方案
- Vue-cli安装与项目新建
- vue 混入
- Vue模拟api数据
- Vue中输入框自动获取焦点的三种方式
- Vue 父子组件之间的通信