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’
解决办法:在tsconfig.json内的compileerOptions下添加 “tyoes”:[“node”]