diff --git a/lib/plugins/plugin/uninstall/uninstall.js b/lib/plugins/plugin/uninstall/uninstall.js index 83cc76f03..6ae271b9e 100644 --- a/lib/plugins/plugin/uninstall/uninstall.js +++ b/lib/plugins/plugin/uninstall/uninstall.js @@ -96,9 +96,9 @@ class PluginUninstall { _.pull(plugins, this.options.pluginName); if (_.isEmpty(plugins)) { if (isArrayPluginsObject) { - _.unset(serverlessFileObj, 'plugins'); + delete serverlessFileObj.plugins; } else { - _.unset(serverlessFileObj.plugins, 'modules'); + delete serverlessFileObj.plugins.modules; } } return fse.writeJson(serverlessFilePath, serverlessFileObj); diff --git a/lib/utils/yamlAstParser.js b/lib/utils/yamlAstParser.js index 020fb808a..e90b1fa43 100644 --- a/lib/utils/yamlAstParser.js +++ b/lib/utils/yamlAstParser.js @@ -145,13 +145,13 @@ const removeExistingArrayItem = (ymlFile, pathInYml, removeValue) => _.pull(arrayProperty, removeValue); if (_.isEmpty(arrayProperty)) { - _.unset(currentNode, arrayPropertyName); + delete currentNode[arrayPropertyName]; pathInObjectTree.push(currentNode); for (let i = pathInObjectTree.length - 1; i > 0; i--) { if (Object.keys(pathInObjectTree[i]).length > 0) { break; } - _.unset(pathInObjectTree[i - 1], pathInYmlArray[i - 1]); + delete pathInObjectTree[i - 1][pathInYmlArray[i - 1]]; } }