Open uuykay opened 4 years ago
Typescript has a path mapping feature that can be configured to alias modules. The most straightforward way I know of to do this is to configure in tsconfig.json
:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@*": ["src/*"]
}
}
does this only work on .ts[x] files? I can't seem to get this to work.
@lettertwo 's fix doesnt work. Tried this but this doesnt fix anything
Hi there,
So I love this plugin, but wanted to try using it with Typescript. I installed the "gatsby-plugin-typescript" and when I convert a .js file to .tsx, TS complains about not being able to find the module. For example:
import ContentContainer from "@components/ContentContainer"
Cannot find module '@components/ContentContainer'.
I have tried following the guide here https://www.mrozilla.cz/blog/gatsby-eslint-vscode-import-alias/ without success. Any hints?