You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
let projectName = process . argv [ 3 ]
let glob = require ( 'glob' )
function getEntry ( ) {
let entries = { }
if ( process . env . NODE _ENV == 'production' ) {
entries = {
index : {
// page的入口
entry : 'src/views/' + projectName + '/main.js' ,
// 在 dist/index.html 的输出
filename : 'index.html' ,
title : projectName ,
chunks : [ 'chunk-vendors' , 'chunk-common' , 'index' ]
}
}
} else {
let items = glob . sync ( './src/views/*/main.js' )
for ( let i in items ) {
let filepath = items [ i ]
let fileList = filepath . split ( '/' ) ;
let fileName = fileList [ fileList . length - 2 ] ;
entries [ fileName ] = {
entry : ` src/views/ ${ fileName } /main.js ` ,
// 在 dist/index.html 的输出
filename : ` ${ fileName } .html ` ,
title : ` ${ fileName } ` ,
// 提取出来的通用 chunk 和 vendor chunk。
chunks : [ 'chunk-vendors' , 'chunk-common' , fileName ]
}
}
}
return entries
}
let pages = getEntry ( )
module . exports = {
outputDir : 'dist/' + projectName ,
productionSourceMap : false ,
pages : pages ,
publicPath : process . env . NODE _ENV === 'production' ? './' : '/' ,
devServer : {
contentBase : 'dist' ,
compress : false , //gzip
disableHostCheck : true ,
port : "80" ,
clientLogLevel : 'error' , //浏览器控制台日志, 默认info
open : false ,
inline : true ,
hot : true , //开启HMR
publicPath : '/' , //默认/,确保 publicPath 总是以斜杠(/)开头和结尾。
proxy : {
'/dsideal_yy/' : {
target : 'http://10.10.14.199' ,
changeOrigin : true ,
secure : false
} ,
'' : {
target : 'http://10.10.14.199' ,
pathRewrite : { "^/" : "/dsideal_yy/" } ,
changeOrigin : true ,
secure : false
}
}
}
}