-
Notifications
You must be signed in to change notification settings - Fork 2
/
vue.config.js
executable file
·53 lines (46 loc) · 1.27 KB
/
vue.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const path = require('path')
const glob = require('glob')
const PAGES_PATH = path.resolve(__dirname, './src/pages')
const pages = {}
//配置 pages 目录下的多页面,通过循环获取每一个 page 文件夹下的 html 和 js
glob.sync(PAGES_PATH + '/*/main.js').forEach(filepath => {
const pageName = path.basename(path.dirname(filepath))
pages[pageName] = {
entry: filepath,
template: path.dirname(filepath) + '/index.html',
filename: `${pageName}.html`,
chunks: ['chunk-vendors', 'chunk-common', pageName]
}
})
console.log(pages)
module.exports = {
pages: pages,
productionSourceMap: false,
parallel: require('os').cpus().length > 1,
chainWebpack: config => {
config.module
.rule('eslint')
.exclude
.add(/mock/)
.end()
config.module
.rule('css')
.test(/\.css$/)
.oneOf('vue')
.resourceQuery(/\?vue/)
.use('px2rem')
.loader('px2rem-loader')
.options({
remUnit: 75
})
if (process.env.npm_config_report) {
config
.plugin('webpack-bundle-analyzer')
.use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
}
},
devServer: {
index: 'page1.html',
open: process.platform === 'darwin'
}
}