The problem code

 <img src={require('src/assets/images/common/lazyImg.jpg')} alt=''/>
Copy the code

1. Add default during introduction.

 <img src={require('src/assets/images/common/lazyImg.jpg').default} alt=''/>
Copy the code

Modify webpack.config.js at line 400 or so. NPM run eject is required to expose the Webpack configuration, but

{
   test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
   loader: require.resolve('url-loader'),
   options: {
     limit: imageInlineSizeLimit,
     name: 'static/media/[name].[hash:8].[ext]',
     esModule: false
  },
},
Copy the code

Both methods have been tried and both work. The first requires no additional action, but default is added each time it is introduced. The second requires NPM Run eject, exposing the WebPack configuration.