简体   繁体   中英

VSCode javascript not recognize imports

How do I get my vscode to list all files when performing an import? It only recognizes .js .ts .jsx .tsx files

But it doesn't recognize images, css or any other files during import.

Do you have an extension for this? Or should I add something to my vscode config.json?

I have a styles.module.css file in the folder ToggleBar but it is not listed when i use ./ from import. The same happens with images, svgs etc...1

The import statement only works for ES6 JS/TS modules, which the CSS and image files are not. Configuring the jsconfig.json file will not help in this context, as images and other assets like css and sass files are not ES6 modules which the compiler can discover.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM