From 04bc44a87a03ee8aa021137fcd42a521c0c01036 Mon Sep 17 00:00:00 2001 From: radswiat Date: Wed, 12 Apr 2017 10:05:43 +0100 Subject: [PATCH] Fix aiv log full issue due to no argv execution --- demo/dist/index-bundle.js | 4 ++-- demo/package.json | 3 +++ dist/WebpackAutoInjectVersion.js | 6 ++++++ package.json | 2 +- src/core/utils.js | 6 ++++++ 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/demo/dist/index-bundle.js b/demo/dist/index-bundle.js index 4cc4449..ae932ef 100644 --- a/demo/dist/index-bundle.js +++ b/demo/dist/index-bundle.js @@ -1,4 +1,4 @@ -// [AIV] Build version: 0.5.1 +// [AIV] Build version: 0.5.2 /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; @@ -71,7 +71,7 @@ /* 0 */ /***/ (function(module, exports) { -module.exports = "TitleMy awesome project | 0.5.1>" +module.exports = "TitleMy awesome project | 0.5.2>" /***/ }), /* 1 */ diff --git a/demo/package.json b/demo/package.json index 91a3f26..727b565 100644 --- a/demo/package.json +++ b/demo/package.json @@ -14,5 +14,8 @@ "html-minify-loader": "^1.1.0", "raw-loader": "^0.5.1", "webpack": "^2.3.3" + }, + "dependencies": { + "webpack-auto-inject-version": "^0.5.1" } } diff --git a/dist/WebpackAutoInjectVersion.js b/dist/WebpackAutoInjectVersion.js index 5b82468..d05f435 100644 --- a/dist/WebpackAutoInjectVersion.js +++ b/dist/WebpackAutoInjectVersion.js @@ -273,6 +273,12 @@ var argv = __webpack_require__(18).argv; * @returns {boolean} */ function isArgv(arg) { + if (typeof argv.env === 'undefined') { + return false; + } + if (typeof argv.env[arg] === 'undefined') { + return false; + } return Boolean(argv.env[arg]); } diff --git a/package.json b/package.json index 5899c6f..d50c929 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "webpack-auto-inject-version", - "version": "0.5.1", + "version": "0.5.3", "repository": "radswiat/webpack-auto-inject-version", "description": "Webpack plugin for auto inject version from package.json", "main": "dist/WebpackAutoInjectVersion.js", diff --git a/src/core/utils.js b/src/core/utils.js index 4d158ad..bd2575a 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -9,6 +9,12 @@ let argv = require('optimist').argv; * @returns {boolean} */ export function isArgv(arg) { + if (typeof argv.env === 'undefined') { + return false; + } + if (typeof argv.env[arg] === 'undefined') { + return false; + } return Boolean(argv.env[arg]); }