-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdefaultConfig.js
More file actions
41 lines (37 loc) · 1.09 KB
/
Copy pathdefaultConfig.js
File metadata and controls
41 lines (37 loc) · 1.09 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
/**
* Copyright (c) 2015-present, Alibaba Group Holding Limited.
* All rights reserved.
*/
'use strict';
var path = require('path');
var fs = require('fs');
const WEBPACK_CONFIG = 'web/webpack.config.js';
/**
* Default configuration for the CLI.
*
* If you need to override any of this functions do so by defining the file
* `rw-cli.config.js` on the root of your project with the functions you need
* to tweak.
*/
var config = {
getRoot() {
if (__dirname.match(/node_modules[\/\\]febs-react-web[\/\\]local-cli$/)) {
// CLI is running from node_modules.
// This is the default case for all projects created using 'febs-react-web init'.
return path.resolve(__dirname, '../../..');
} else {
return path.resolve(__dirname, '..');
}
},
getWebpackConfig(customConfig) {
var webpackConfig = path.join(this.getRoot(), customConfig || WEBPACK_CONFIG);
if(!fs.existsSync(webpackConfig)) {
throw new Error(
'Can\'t find webpack config file at "' +
webpackConfig + '"'
);
}
return webpackConfig
}
};
module.exports = config;