Skip to content

Module imports need to recognize/ignore the file extension #4595

Closed
@weswigham

Description

Currently, TS can't find modules when you use a file extension in the import name (import {Foo} from './foo.ts';) - SystemJS updated and file extensions are now required (though the spec issue is still under discussion) on imports (without setting some legacy settings in System.config). So when compiling with --module, you can either have a functioning typechecker (no extensions on your imports) or a functioning runtime (.js on your imports, since your result files have .js extensions). This is complicated further by systemjs's bundler, which looks for dependent files before TS transpiles them, so you have to use .ts extensions on your imports so the bundler can resolve the paths to real ones.

This extension madness is all incredibly awkward to work with, and I'm not sure if this needs module resolution logic updating on our part, arguing for old behavior on the loader spec, or talking to systemjs and having them change how they're finding modules ignoring the spec.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions