1 Star 0 Fork 2

shech / app-vue-cube

forked from LiangJ / app-vue-cube 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
vue.config.js 2.65 KB
一键复制 编辑 原始数据 按行查看 历史
梁晶 提交于 2019-04-24 17:52 . Update vue.config.js
let path = require('path');
let glob = require('glob');
const webpack = require('webpack');
// const autoImportCss = "./src/styles/imports.styl";
/**
*配置pages多页面获取当前文件夹下的html和js
*
* @author LiangJ
* @param {String} globPath
* @returns
*/
function getEntry(globPath) {
let entries = {},
basename,
tmp,
pathname;
glob.sync(globPath).forEach(function(entry) {
basename = path.basename(entry, path.extname(entry));
console.log(`entry=====${entry}`);
tmp = entry.split('/').splice(-3);
pathname = basename; // 正确输出js和html的路径
console.log(`pathname=====${pathname}`);
entries[pathname] = {
entry: 'src/' + tmp[0] + '/' + tmp[1] + '/app.js',
template: 'src/' + tmp[0] + '/' + tmp[1] + '/' + tmp[2],
title: tmp[2],
filename: tmp[2]
};
});
return entries;
}
let pages = getEntry('./src/pages/**?/*.html');
console.log(pages);
module.exports = {
//引用文件的相对路径
baseUrl: process.env.NODE_ENV === 'production' ? './' : '/',
// 输出文件目录
// outputDir: "dist/woApp",
pages,
// 生产环境是否生成 sourceMap 文件
// productionSourceMap: false,
devServer: {
index: 'index.html', //启动serve 默认打开index页面
open: process.platform === 'darwin',
port: 8080,
proxy: {
'/api': {
target: 'https://221.192.1.84:9095/SSPMobileServer',
changeOrigin: true
// pathRewrite: path => {
// return path.replace("/api", "/");
// }
}
}
// before: app => {
// app.post("/360ChannelView/getBasicInfo", (req, res) => {
// let resData = require("@/mock/data.json");
// res.json(resData); //接口返回json数据,上面配置的数据seller就赋值给data请求后调用
// });
// }
},
css: {
loaderOptions: {
stylus: {
'resolve url': true,
import: ['./src/theme']
}
}
},
pluginOptions: {
'cube-ui': {
postCompile: true,
theme: true
}
},
chainWebpack: config => {
//moment.js 只打包中文
config
.plugin('context')
.use(webpack.ContextReplacementPlugin, [/moment[/\\]locale$/, /zh-cn/]);
// const types = ["vue-modules", "vue", "normal-modules", "normal"];
// types.forEach(type =>
// addStyleResource(config.module.rule("stylus").oneOf(type))
// );
}
};
/**
*自动导入文件设置
*
* @author LiangJ
* @param {*} rule
*/
// function addStyleResource(rule) {
// rule
// .use("style-resource")
// .loader("style-resources-loader")
// .options({
// patterns: [path.resolve(__dirname, autoImportCss)]
// });
// }
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/swantb/app-vue-cube.git
git@gitee.com:swantb/app-vue-cube.git
swantb
app-vue-cube
app-vue-cube
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891