forked from jingleo/plato
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_base.js
86 lines (73 loc) · 2.14 KB
/
_base.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { resolve } from 'path'
import _debug from 'debug'
const debug = _debug('plato:config:base')
const config = {
env: process.env.NODE_ENV || 'development',
pkg: require('../package.json'),
// ----------------------------------
// Theme Configuration
// ----------------------------------
theme: 'default',
// ----------------------------------
// Project Structure
// ----------------------------------
path_base: resolve(__dirname, '../'),
dir_src: 'src',
dir_dist: 'dist',
dir_test: 'test',
// ----------------------------------
// Server Configuration
// ----------------------------------
server_host: '0.0.0.0', // binds to all hosts
server_port: process.env.PORT || 3000,
// ----------------------------------
// Compiler Configuration
// ----------------------------------
compiler_devtool: 'source-map',
compiler_hash_type: 'hash',
compiler_html_minify: false,
compiler_public_path: '',
compiler_vendor: [
'vue',
'vue-router',
'vuex',
'vuex-actions',
'vuex-localstorage'
]
}
// ------------------------------------
// Environment
// ------------------------------------
config.globals = {
__DEV__: config.env === 'development',
__PROD__: config.env === 'production',
__TEST__: config.env === 'test'
}
// ------------------------------------
// Validate Vendor Dependencies
// ------------------------------------
config.compiler_vendor = config.compiler_vendor
.filter(dep => {
if (config.pkg.dependencies.hasOwnProperty(dep)) {
return true
}
debug(
'Package "' + dep + '" was not found as an npm dependency in package.json; ' +
'it won\'t be included in the webpack vendor bundle.\n' +
'Consider removing it from compiler_vendor in "./config/_base.js"'
)
})
// ------------------------------------
// Utilities
// ------------------------------------
config.paths = (() => {
const base = (...args) =>
resolve.apply(resolve, [config.path_base, ...args])
return {
base,
src: base.bind(null, config.dir_src),
dist: base.bind(null, config.dir_dist),
test: base.bind(null, config.dir_test)
}
})()
export default config