-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
41 lines (37 loc) · 1022 Bytes
/
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
const fs = require('fs')
const path = require('path')
const src = path.join(__dirname, 'examples')
const __build__ = '__build__'
const PAGE = {
title: 'Vue Attache Example',
template: path.join(src, 'index.html'),
chunks: ['chunk-vendors', 'chunk-common']
}
const pages = fs.readdirSync(src).reduce((pages, dir) => {
if (dir !== __build__) {
const fullPath = path.join(src, dir)
const entry = path.join(fullPath, 'main.js')
if (fs.statSync(fullPath).isDirectory() && fs.existsSync(entry)) {
const page = Object.create(PAGE)
const template = path.join(fullPath, 'index.html')
if (fs.existsSync(template)) {
page.template = template
}
page.filename = `${dir}.html`
page.entry = entry
page.chunks.push(dir)
pages[dir] = page
}
}
return pages
}, {
index: {
...PAGE,
entry: `${src}/main.js`,
chunks: ['chunk-vendors', 'chunk-common', 'index']
}
})
module.exports = {
outputDir: path.join(__dirname, __build__),
pages
}