简体   繁体   中英

VSCode add .js extension on import autocomplete

I am using VSCode and JavaScript ES6 Modules .

If I autocomplete an import like this import * as test from './test' the .js ending on ./test is missing and I have to add it manually .

Is there a setting to automatically add the extension ?

Add this to your settings.json

"javascript.preferences.importModuleSpecifierEnding": "js",
"typescript.preferences.importModuleSpecifierEnding": "js",

Or in the Settings UI

自动导入js

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