This is the reason why the if statement includes !internalFileName.match('node_modules') - so package.json's inside node_module folders are ignored. You are right with the additional function calls, but here would it be better to combine https://github.com/mllrsohn/grunt-node-webkit-builder/blob/master/tasks/node_webkit_builder.js#L89 and the compress call to only get the file list once (we are talking ms here ..)