Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #12300
Closed
Open
Issue created Apr 16, 2022 by Administrator@rootContributor

typescript didn't enabled for a fresh CRA app

Created by: j0053f

I 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

Assignee
Assign to
Time tracking