typescript didn't enabled for a fresh CRA app
See original GitHub issueI have a CRA app. I want to start using typescript. according to this guide for adding typescript to an existing Create React App project I installed the typescript and required type definitions:
npm install --save typescript @types/node @types/react @types/react-dom @types/jest
and add a file named test.tsx
contains:
export default function Test(){
return (
<div>this is test to see typescirpt</div>
)
}
and import and use it in main.js
ctrl+c
previous development server.
and did npm start
.
I’m getting bellow error.
Failed to compile.
Module not found: Error: Can't resolve './test' in '/home/g/w/projects/movie_watch_list_frontend/src'
ERROR in ./src/App.js 15:0-26
Module not found: Error: Can't resolve './test' in '/home/g/w/projects/movie_watch_list_frontend/src'
webpack compiled with 1 error
also, there isn’t any auto-created tsconfig
file in the project folder.
I pushed the change that I made in a new branch named typescript to my reposity
also, I repeat this process for a fresh CRA app, and the same error happened.
am I doing something wrong?
_Originally posted by @j0053f in https://github.com/facebook/create-react-app/discussions/12295_
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:7
Top GitHub Comments
that’s right, it seems that this function is only used when init.
same issue.