I am working on a React application and use Webpack and Typescript . I would like to use the image in one of the <img/> tags. However, I did not find a suitable way to access image files.
webpack.config.js
... module: { rules: [ ... { test: /\.(png|jpe?g|svg)$/, loader: 'file-loader', options: { name: 'assets/[name].[ext]', } } ]
app.tsx
... render() { return <img src='/assets/logo-large.png' alt="logo"/> }
When starting the application, the asset assets/logo-large.png not found.
source share