Closed
Description
openedon Nov 1, 2018
I'd like there to be a way to always require the file extension to be specified for relative import statements. At the moment extensionless imports always just work. Even 'Go to Definition' just assumes it should open the JS file.
src/
- index.js
- foo.js
// index.js
import { Foo } from './foo'; // extensionless
I'd like there to be a jsconfig option to disable this behavior and require a file extension to be specified.
import { Foo } from './foo';
^^^^^^^ No definition found for 'foo'
// fix
- import { Foo } from './foo';
+ import { Foo } from './foo.js';
I'm asking because extensionless imports don't really work in the browser if you're not using a module bundler. It can only work if the HTTP server supports extensionless imports, which is a big ask.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment