From @Rich-Harris on October 6, 2017 14:58
- VSCode Version: Code 1.17.0 (be377c0faf7574a59f84940f593a6849f12e4de7, 2017-10-05T06:07:51.906Z)
- OS Version: Darwin x64 16.7.0
- Extensions:
| Extension |
Author (truncated) |
Version |
| Handlebars |
and |
0.2.0 |
| vscode-eslint |
dba |
1.3.2 |
| prettier-vscode |
esb |
0.24.0 |
| vscode-import-cost |
wix |
2.5.0 |
Steps to Reproduce:
- Open or create a JavaScript file
- Start typing
import x from './ followed by the name of a sibling file
Reproduces without extensions: Yes
When you start writing a local import statement, the intellisense helper will offer up foo and bar rather than foo.js and bar.js. Extensionless imports is a Node idiom that is incompatible with browser module loaders — adding the file extension would increase browser compatibility with no ill-effect on Node apps (to the contrary, it speeds up module resolution, and I'd argue it makes code more explicit and readable).
I wonder if you would consider changing the behaviour to add file extensions by default?
Copied from original issue: microsoft/vscode#35730
From @Rich-Harris on October 6, 2017 14:58
Steps to Reproduce:
import x from './followed by the name of a sibling fileReproduces without extensions: Yes
When you start writing a local
importstatement, the intellisense helper will offer upfooandbarrather thanfoo.jsandbar.js. Extensionless imports is a Node idiom that is incompatible with browser module loaders — adding the file extension would increase browser compatibility with no ill-effect on Node apps (to the contrary, it speeds up module resolution, and I'd argue it makes code more explicit and readable).I wonder if you would consider changing the behaviour to add file extensions by default?
Copied from original issue: microsoft/vscode#35730