generator-angular2-library: `dist/` should not be deleted on rebuilds, only contents instead

@jvandemo heya, I recently discovered a shortcoming in my starter, where the dist/ dir is always deleted.

This causes linked libraries to not update the project that are using it, since the link is broken when dist/ is deleted. Instead, only its contents should be deleted.

Details and repro can be found at https://github.com/angular/angular-cli/issues/6195.

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Reactions: 3
  • Comments: 15 (4 by maintainers)

Most upvoted comments

I have just released v10.2.2, which no longer deletes the dist directory.

@filipesilva and @bniedermeyer — Thank you for your help! Much appreciated! 👍

I will leave this issue open to further investigate the refresh issue.

@filipesilva — Thank you for your note, much appreciated! 👍

I will have a look at this tomorrow morning before work and will keep you posted. Thanks again!

now I get the error

RROR in ../ng-library/dist/index.js
Module build failed: Error: ENOENT: no such file or direc
tory, open '.../ng-library/dist/index.js'
 @ ./src/app/app.module.ts 10:0-53
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200
./src/main.ts
webpack: Failed to compile.

The workaround around i am using is to comment out the code in clean:dist task

@clarkj Sure thing. I made a modification to deleteFolders(). I posted a Gist here. Because using del, deletes the folder itself, you just have to set it to ignore.

Edit: I should mention that this doesn’t fix the refresh issue with running ng serve. I still need to restart my dev server for the changes to be picked up but I do see them after a restart.

Update: removing `clean:dist’ from line 173 and 182 is actually necessary to fully get refreshes to work. This isn’t ideal. Discussion ongoing in angular/angular-cli#6195.