Webpack & Typescript image import

后端 未结 3 653
醉话见心
醉话见心 2020-12-09 01:20

I\'m working on a React application and using Webpack & Typescript. I would like to use an image in one of the &

3条回答
  •  感动是毒
    2020-12-09 01:55

    You need to require the image and then use that variable as the source, like so:

    // At the top of the file, with all other imports/requires
    const imageSrc = require('/assets/logo-large.png')
    
    ...
    
    render() {
        return logo
    }
    

提交回复
热议问题