VSCode add .js extension on import autocomplete

Viewed 2362

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?

1 Answers

Add this to your settings.json

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

Or in the Settings UI

auto imports js

Related