webpack not able to import images( using express and angular2 in typescript)

前端 未结 7 1492
难免孤独
难免孤独 2020-12-09 04:00

I am not able to import images in my headercomponent.ts. I suspect it is because of something i am doing wrong while compiling ts(using webpack ts loader) because same thin

相关标签:
7条回答
  • 2020-12-09 04:45

    If you want to use the ES6 syntax for importing.

    First be sure that in your tsconfig.json you have:

    target: 'es5',
    module: 'es6'
    

    The following should now work:

    import MyImage from './images/my-image.png';
    
    0 讨论(0)
提交回复
热议问题