Angular 7 使用require 出现的问题: Cannot find name 'require'. Do you need to install......
报错详情:
创建了一个新的angular项目,打算通过require使用js,出现了“ERROR in src/app/app.component.ts(11,9): error TS2580: Cannot find name 'require'. Do you need to install type definitions for node? Try `npm i @types/node`” 的问题
问题解决:
找到tsconfig.app.json文件
在types中加入"node"即可