Search code examples
angularnpmangular7

Assets not copied from project to dist folder in Angular 7 library


i've generated new library via Angular CLI v7

ng generate library library-name

After that, i've created folder assets in src folder. So my folder structure is

| - src
| - - lib
| - - - assets

My problem is, that after

ng build --project=library-name

are assets missing in my dist folder. All modules, components, styles etc. are exported in dist folder. But if i create another directory in this hierarchy, directory is not exported to dist at all.

How can i force assets to be exported in dist folder after build ?

Thanks


Solution

  • This is not currently supported by the CLI, you can read more in the GitHub issue here: https://github.com/angular/angular-cli/issues/11071#issuecomment-395096971

    An easy workaround as suggested is to manually cp -r path/to/lib/assets list/path/to/lib the assets after you build the library. You could use a post build script in your package.json for this.