3

Recently, I published an NPM package. In that package, there's a project folder that contains multiple other folder and some of them are empty too, purposely.

But when published to NPM, empty folders are deleted by default. I came to know of this when I installed my own module.

What's this issue and how to avoid deletion of these empty folder? Thanks for helping.

Solution:

The only solution so far is to creat directories programatically. Thanks for your help.

shahzaibkhalid
  • 117
  • 2
  • 8
  • Could you explain why it's important to you to have empty folders in your npm package? I can't think of a use case where this would be relevant – Patrick Hund Nov 23 '17 at 13:31
  • Empty folders are not added to git too, you can add an empty file inside. May be related : https://stackoverflow.com/questions/115983/how-can-i-add-an-empty-directory-to-a-git-repository – Gabriel Bleu Nov 23 '17 at 13:32
  • I added a project structure into it that requires empty directories to automate few things but as you said that there's no workaround so I 'm creating directories programatically. Thanks for your help. – shahzaibkhalid Nov 23 '17 at 13:50
  • 1
    For me empty dirs are important as my package is a boilerplates generator. I want to have some empty dirs in the template. I can add it programmatically, but would be good if I didn't have to. – Henrique Bruno Feb 04 '22 at 21:04

0 Answers0