Skip to content

Update imports to use explicit file extensions #223

Open
@mattrunyon

Description

@mattrunyon

ES Module imports need explicit extensions per the spec. Without file extensions, this is usually resolved by Webpack, but technically import foo from './foo' is looking for the file foo and not foo.js.

TypeScript will not add the extension for you in TS files (microsoft/TypeScript#16577), but it is valid to import foo from './foo.js' in TS even if foo is a TS file.

We are using a babel plugin to add the extensions currently (#188). This is fine, but it would be nice to not rely on the small package with relatively few downloads.

Adding the file extension to all imports will require some update to eslint configs to fix the import resolution rules

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions