I have a small Angular2 app that utilizes Webpack for project building and scaffolding.
One issue I've encountered is the inability to load images specified in TypeScript files during production. After running npm run build
, I noticed that these images were not included in the generated files (although images specified in SCSS are generated).
Below is an example of how my component looks like, and my Webpack configuration is pretty basic.
My main question is if it's possible to resolve this issue. It might require adding a Webpack loader to handle this case, but as a newcomer to Webpack, I'm unsure where to start.
import { Component, OnInit, Injectable } from '@angular/core';
@Injectable()
@Component({
selector: 'custom-template',
templateUrl: './custom.html'
})
export class CustomComponent {
public data: any = [
{
image: '../../../assets/images/1.jpg',
text: 'Text 1...'
},
{
image: '../../../assets/images/2.jpg',
text: 'Text 2...'
},
{
image: '../../../assets/images/3.jpg',
text: 'Text 3...'
}
];
}