diff --git a/bin/cli.js b/bin/cli.js index 054cfb1..b39c558 100755 --- a/bin/cli.js +++ b/bin/cli.js @@ -96,7 +96,7 @@ program .option('--server [port]', 'start http server') .option('--speed', 'stat webpack build speed') .description('webpack building') - .action((env, options) => { + .action((env = 'prod', options) => { const config = utils.initWebpackConfig(program, { env, cliDevtool: options.devtool }, { speed: options.speed }); // 编译完成, 启动 HTTP Server 访问静态页面 if (options.server) { diff --git a/lib/utils.js b/lib/utils.js index 3aa627c..3117de5 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -90,7 +90,7 @@ module.exports = { }, initWebpackConfig(program, option = {}, cliConfig = {}) { - const { baseDir = process.cwd(), env = 'prod' } = option; + const { baseDir = process.cwd(), env } = option; const { filename, port, framework, type, devtool, size, watch, build, hash, compress, dll, web, node, webpack } = program; const target = web ? 'web' : (node ? 'node' : undefined); const cli = merge({ env, filename, port, size, dll, web, node, webpack }, cliConfig); diff --git a/package.json b/package.json index 214c92b..4da3896 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "easywebpack-cli", - "version": "4.0.0", + "version": "4.0.1", "description": "Webpack Building Command Line And Boilerplate Init Tool", "bin": { "easywebpack": "bin/cli.js",