Open vincentsels opened 8 years ago
Same here... did you manage to solve this issue?
Found the solution, probably issue with newer versions of TypeScript (i.e. 1.8.1):
Form the file tsconfig.json:
{
"compilerOptions": {
"target": "ES6",
"jsx": "react",
"noEmit": true
},
"exclude": [
"node_modules",
"dev_server.js"
]
}
Remove the line "noEmit": true
.
Thanks to: https://github.com/keokilee/react-typescript-boilerplate/issues/158
I have found a post on stack overflow that solves the problem: http://stackoverflow.com/questions/37895944/react-transform-catch-errors-does-not-look-like-a-react-component
still, it should work without this versioning problem...
@svdoever react-scripts start
will run the typescript compiler and overwrite tsconfig.json
.
> react-scripts start
The following changes are being made to your tsconfig.json file:
- compilerOptions.noEmit must be true
- compilerOptions.jsx must be preserve (JSX is compiled by Babel)
Your solution works, but react-scripts
undoes it automatically. ☹️
@byxor I noticed as well that react-scripts started to modify the tsconfig.json, but in another context. Not good:-( This project is so long ago, I have no clue what it was all about... sorry...
@svdoever No worries! I made a workaround by creating separate tsconfig.json
files for production/dev builds (tsconfig.production.json
and tsconfig.development.json
) and conditionally copying them into the project root before building.
I can elaborate further on this if anybody else is suffering from the same issue.
Edit: Here's a github issue where I've discussed my solution in a bit more depth.
@svdoever
react-scripts start
will run the typescript compiler and overwritetsconfig.json
.
on webpack config
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'ts-loader',
options: {
compilerOptions: {
noEmit: false,
},
},
},
],
npm install
finished fine, but when trying to run throughnpm start
I get the following output & error: