forked from symbol/explorer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
47 lines (44 loc) · 1.05 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
// Read config files that may not exist.
const fs = require('fs')
const webpack = require('webpack')
const readConfig = configPath => {
let config
try {
config = fs.readFileSync(configPath, 'utf8')
} catch (error) {
if (error.code === 'ENOENT') {
// File not found, copy from template to config path during bootstrap.
fs.copyFileSync(configPath + '.mt', configPath)
config = fs.readFileSync(configPath, 'utf8')
} else {
throw error
}
}
return config
}
const peersApi = readConfig('src/config/peers-api.json')
const endpoints = readConfig('src/config/endpoints.json')
module.exports = {
// base url
publicPath: '/',
// output dir
outputDir: './www',
// eslint-loader check
lintOnSave: true,
// webpack-dev-server
devServer: {
host: '0.0.0.0',
port: 8080,
before: app => {
}
},
// Define custom variables, dependent on the config variables.
configureWebpack: {
plugins: [
new webpack.DefinePlugin({
PEERS_API: peersApi,
ENDPOINTS: endpoints
})
]
}
}