question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

'paths' disappeared in tsconfig when i run ‘npm start’

See original GitHub issue

My project is init based on create-react-app,and i install ‘typescript’ in my project, then edit the config of ‘tsconfig.json’:

 "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "components/*": [
        "src/components/*"
      ]
    }
  },

when i run ‘npm start’, i got some problems, and one is, ‘paths’ disappeared。

i have got the correct solution,set ‘paths’ in a external files, then send this url to ‘extends’。

But, I am very confused, why did i have this problem????????

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
vinegreetcommented, Mar 22, 2021

@camillalo CRA allows using absolute paths out of the box. Even though you’ll be only able to use actual folder names, it does the job well. The docs: https://create-react-app.dev/docs/importing-a-component/#absolute-imports

{
  "compilerOptions": {
    "baseUrl": "src"
  },
  "include": ["src"]
}
0reactions
ZurakowskiJakubcommented, Oct 18, 2020

Getting the same issue when trying to add "paths" : { ... } to my tsconfig.json.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why is my Typescript "paths" setting getting removed when I ...
When I set it up, my files look fine and do not complain. However, when I run the project, the "paths" gets deleted...
Read more >
tsconfig-paths - npm
Load node modules according to tsconfig paths, in run-time or via API. ... Start using tsconfig-paths in your project by running `npm i ......
Read more >
Stop using Relative Paths — Use Import Aliases for ... - Medium
If we run tsc tsconfig.json in our build script, what we notice is that the paths are not mapped correctly in the output...
Read more >
Migrating a Create React App project to Vite - Darek Kay
Run npm install or yarn . I recommend deleting node_modules beforehand. Replace scripts in package.json (I'll cover test later):.
Read more >
Creating a React app with TypeScript and ESLint with ...
We are also telling Webpack to open the browser after the server has been started. Adding an npm script to run the app...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found