React - 17.0 TypeScript - 4.1.2 Babel - 7.13.14
tsconfig.json
{
"compilerOptions": {
"target": "es6",
"module": "esnext",
"moduleResolution": "node",
"jsx": "react",
"sourceMap": true
},
"exclude": [
"node_modules",
"dist"
],
"compileOnSave": false,
"buildOnSave": false,
"atom": { "rewriteTsconfig": false }
}
I encountered the following error: ERROR in ./src/main/frontend/app/leftmenu/index.ts (1,21): error TS2307: Cannot find module 'react'. when running npm run build
index.ts
import {react} from 'react';
import {MenuService} from './menuService';
import {LeftMenuController} from './leftmenu';
react.createModule('app')
.service('MenuService', MenuService)
.component('leftMenu',{
template : require('./leftmenu.html'),
controller : LeftMenuController,
controllerAs : 'lm'
});
Can you advise me on how to resolve the issue of making the react module visible to my index.ts?
Note: The react module is located within the node_modules directory.