-
Notifications
You must be signed in to change notification settings - Fork 492
Setting paths in tsconfig.json does not work #98
Comments
Set a
I use this config:
It works for me :) |
Awesome! Thanks, @Grmiade. This is such a common use case that I was surprised not to find a solution readily. So thanks again! I wonder why both are required and how they both work to make this work. |
|
@Grmiade, thanks for the explanation. It's helpful to know what's doing what! |
@Grmiade how about if the path is not wildcard. How if I added "paths": {
"@/*": ["./src/*"]
} |
Hum, I think the only way is to eject your project and update |
None of the above solutions solve the issue mentioned. There is a glaring discrepancy between create-react-app and typescript paths, but despite all these "closed" issues, it is still broken" Since we cant solve the wbepack issue without ejecting, the solution by @Grmiade is not available. |
@stevematdavies Can you share your |
@Grmiade Should not tsloader used by webpack respect what I write in tsconfig.json? |
I am trying to set the
src
directory as a path so that modules can be imported with short absolute paths (without../../
etc.). For example:instead of
To accomplish this I added the following to tsconfig.json:
However this is still not picking up imports with absolute paths. I get an error like this:
I have created a small example to demonstrate this problem. Please see my repository at https://github.com/archfirst/react-mobx-mui-ts-seed. The import shown above is here: https://github.com/archfirst/react-mobx-mui-ts-seed/blob/master/src/features/home-page.tsx#L9.
The text was updated successfully, but these errors were encountered: