Angular 6 Library assets not included in lib after build

Viewed 1181

I have recently created an Angular library (ng new library) and had an issue after building it with the ng build --prod. My assets folder did not get copied to the dist folder and I can no longer reference my file. When I tried including the assets script in my angular.json I got an error - Schema validation failed with the following errors:

Data path "" should NOT have additional properties(assets).

Is there a way of including assets in an Angular library? Please help

2 Answers

I had the same issue with Angular CLI 6.1.3. Change your assets part in your angular.json file :

"assets": [
  "src/favicon.ico",
  "src/web.config",
  "src/assets"
],

It works even if you don't have a web.config file.

Related