Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to resolve import "@test/test" from "src/App.tsx". Does the file exist? #410

Open
2 tasks done
Auticcat opened this issue Oct 24, 2024 · 0 comments
Open
2 tasks done

Comments

@Auticcat
Copy link

Describe the bug

Hello, was trying to add this plugin to my already existing project. I use wildcards to import a folder and easily import a bunch of components which are stored in another folder. I cannot get it to work with the plugin

Reproduction

Steps reproduced on the React + Typescript Playground

  1. Fix number error in src/App.tsx
const [count, setCount] = useState<number>(1);
  1. Create this file in src/test/test.ts
export const test = () => { alert("test!") }
  1. Edit tsconfig.json and add:
"baseUrl": ".",
    "paths": {
      "@test/*": ["src/test/*"]
    }
  1. Go back to src/App.tsx and let the linter import the test() function, it will look like this:
import { test } from '@test/test';
...
test(); // inside App() scope
  1. Failed to resolve import "@test/test" from "src/App.tsx". Does the file exist?

Expected behavior

Expect that path get successfully resolved

System Info

React + Typescript Playground system info

Additional context

No response

Validations

  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant