1

I have a project with Vite, React and Typescript. I am using VSCode as IDE.

Any file other than .ts or .tsx doesn't get VSCode IntelliSense working when I write import './...'

I first though it was an issue or a missing extension for VSCode but after adding "allowJs": true in my tsconfig.json, I could see .js, .cjs, etc..

Same with "resolveJsonModule": true, I get intellisense for JSON file import.

However, I don't get CSS/SCSS IntelliSense. Is there a way to turn on VSCode IntelliSense for more file extensions or allow typescript to import CSS/SCSS/SVG/etc..?

1 Answer 1

1

A temporary fix I found is to write "import from './'". The .scss files are visible that way, but not if I write "import styles from './'". Same applies for .css. Then obviously add back in an alias if you require.

EDIT:

Fixed it by adding this to my vscode settings.json:

"javascript.suggest.paths": false,
"typescript.suggest.paths": false

I am also using Kohler's Intellisense extension.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.