1

I have an Angular component that I publish with npm. I found it has a CDN dependency for an image and wanted to instead include and distribute that image in the module itself. I've been able to alter my gulp file to include an images folder and after installing the component in a test app I see the image in node_modules/myComponent/images.

The problem is the image in my published component is referencing images/component_image.png, but the parent app using the component of course can't find images/component_image.png.

I need it to be looking for node_modules/myComponent/images/component_image.png. How can I make this relative reference?

Eric Soyke
  • 1,073
  • 1
  • 15
  • 30

1 Answers1

3

@Liam pointed out this is done in the Angular cli configuration, answered Here. I simply needed to add this to my angular.json under assets.

         {
            "glob": "**/*",
            "input": "node_modules/myComponent/assets/images",
            "output": "./assets/images"
          }
Eric Soyke
  • 1,073
  • 1
  • 15
  • 30