Webpack + React + TypeScript: Module not found ... in ... node_modules/react/
Webpack is not resolving .js
files. Add this to your webpack.config.js
.
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx"]
},
Here is the tsconfig.json
I used to run your example.
{
"compilerOptions": {
"jsx": "react",
"lib": ["es6", "dom"],
"rootDir": "src",
"module": "commonjs",
"target": "es5",
"sourceMap": true,
"moduleResolution": "node",
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true
},
"include": [
"./src"
],
"exclude": [
"node_modules",
"build"
]
}