优化工作流

This commit is contained in:
dengtongyu committed 2018-11-15 16:59:28 +08:00
1 parent b7c0e5e2ac
commit 3c07f2fd30
15 files changed
+442 -34

No files matched your search

+3 -1
View File
@@ -34,8 +34,10 @@ exports.init = (type, paths, command) => {
exports.dev = (paths, command) => {
_paths = paths;
_configJson = util.configJson(_paths.targetPath);
if(_configJson.template == 'react') {
webpackConfig.run(paths, command);
webpackConfig.run(paths, command);
}
}
+10 -5
View File
@@ -27,14 +27,18 @@ let _webpackConfig = {
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
},
{
test: /\.styl$/,
use: ['style-loader', 'css-loader', 'stylus-loader']
}
]
},
plugins:[]
};
exports.run = (paths, command) => {
//入口文件
_webpackConfig.entry = path.join(paths.targetPath, 'src', 'index.js');
@@ -68,7 +72,8 @@ exports.run = (paths, command) => {
port: 8088,
hot: true,
//open: true,
stats: {colors: true}
stats: {colors: true},
https: _configJson.https
}
if(_configJson.proxy) {
@@ -84,13 +89,13 @@ exports.run = (paths, command) => {
//node api 启动本地服务
let server = new webpackDevServer(compiler, devServer);
console.log(_webpackConfig);
//console.log(devServer);
server.listen(devServer.port, 'localhost', (err) => {
if(err) {
console.log(err);
}else{
console.log(chalk.bold.green('服务启动: '+ devServer.contentBase +' : http://localhost:' + devServer.port));
console.log(chalk.bold.green('服务启动: '+ devServer.contentBase +' : '+ devServer.https ? 'https' : 'http' + '://localhost:' + devServer.port));
}
});