我们经常会遇到这种引入图片的方式,require引入图片,出现了Cannot find name 'require'. Do you need to install type definitions for node
webpack会自动找到该路径为我们引入该资源,但是我在项目初始化的时候使用require出现了这样的问题 ‘

Cannot find name ‘require’. Do you need to install type definitions
for node’

require引入图片,出现了Cannot find name 'require'. Do you need to install type definitions for node

解决办法:在tsconfig.json内的compileerOptions下添加 “tyoes”:[“node”]
require引入图片,出现了Cannot find name 'require'. Do you need to install type definitions for node

相关文章:

  • 2021-07-14
  • 2022-12-23
  • 2021-11-30
  • 2021-05-30
  • 2021-05-19
  • 2022-12-23
  • 2021-05-06
  • 2022-12-23
猜你喜欢
  • 2021-04-22
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2021-10-18
  • 2021-07-07
  • 2021-11-25
相关资源
相似解决方案