config.default.js
1.8 KB
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
'use strict';
const path = require('path');
module.exports = appInfo => ({
/**
* assets options
* @member Config#assets
* @property {String} url - the host of the assets, it will be `http://127.0.0.1:${devServer.port}` in development.
* @property {String} publicPath - the base path of the assets
* @property {String} templatePath - the file path of template rendering html
* @property {String} templateViewEngine - the view engine for rendering template
* @property {Boolean} crossorigin - if script is cross origin set this config to true
* @property {Boolean} contextKey - the property name of context, default is `context`
* @property {Boolean} devServer - configuration of local assets server
* @property {Boolean} devServer.command - a command for starting a server, such as `webpack`
* @property {Boolean} devServer.port - listening port for the server, it will be checked when starting
* @property {Boolean} devServer.timeout - the timeout for checking listening port
* @property {Boolean} devServer.env - custom environment
* @property {Boolean} devServer.debug - show stdout/stderr for devServer
* @property {Boolean} devServer.waitStart - whether wait devServer starting
* @property {Function} nonce(ctx) - dynamic generate nonce for csp(https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP)
*/
assets: {
isLocalOrUnittest: appInfo.env === 'local' || appInfo.env === 'unittest',
url: '',
publicPath: '',
templatePath: '',
templateViewEngine: '',
crossorigin: false,
contextKey: 'context',
dynamicLocalIP: true,
devServer: {
enable: true,
command: '',
autoPort: false,
port: null,
portPath: path.join(appInfo.baseDir, 'run/assetsPort'),
env: {},
debug: false,
timeout: 60 * 1000,
waitStart: false,
},
},
});