-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathconfig.js
50 lines (46 loc) · 1.22 KB
/
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
'use strict'
const program = require('commander')
const { resolve } = require('./utils')
const { packagerOptions } = require(resolve('package.json'))
const { MODE, NODE_ENV, PORT } = process.env
const fileExtConfig = {
swan: {
template: 'swan',
script: 'js',
style: 'css',
platform: 'swan'
},
wx: {
template: 'wxml',
script: 'js',
style: 'wxss',
platform: 'wx'
}
}
module.exports = Object.assign({
env: {
MODE: JSON.stringify(MODE),
NODE_ENV: JSON.stringify(NODE_ENV)
},
index: resolve(program.output, 'index.html'),
htmlTemplate: 'index.html',
assetsRoot: resolve(program.output),
assetsSubDirectory: MODE === 'mp' ? '' : 'static',
proxyTable: {},
host: 'localhost',
port: PORT || program.port,
autoOpenBrowser: program.open,
errorOverlay: true,
notifyOnErrors: true,
poll: false,
useEslint: true,
showEslintErrorsInOverlay: false,
devtool: NODE_ENV === 'development' ? 'cheap-module-eval-source-map' : '#source-map',
cacheBusting: true,
cssSourceMap: true,
productionSourceMap: false,
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
bundleAnalyzerReport: program.analyze,
fileExt: fileExtConfig[program.target]
}, packagerOptions)