arloliu / copy-node-modules

Fast deploy Node.js modules from local source folder to distination folder
26 stars 14 forks source link

Error thrown if dependencies key is missing #19

Open AlexTM84 opened 5 years ago

AlexTM84 commented 5 years ago

Based on commit 0140808d7109ebc111351fda84fc4c8246ac6203 lines 129 and 137 of src/index.js should be changed into Object.keys(pkgContent.dependencies || {}).forEach((name) => { and Object.keys(pkgContent.devDependencies || {}).forEach((name) => { respectively. In other words, add || {} when accessing dependencies and devDependencies, as you already do it on line 67.