Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Automatically add js extension for relative module IDs #7

Description

@antonmoiseev

What do you think about automatically adding .js extension while resolving relative module IDs? Relative URLs always represent a file so it should be safe to append it.

Motivation

We use TypeScript and ES6 modules for writing application code. For importing local modules we use relative paths:

import Logger from './lib/logger';

After transpiling it turns into an AMD module:

define(["require", "exports", './lib/logger'], callbackFn);

The module itself is loaded as part of an HTML Import:

<script src="lib/logger.js"></script>

And registered within the module registry with following name:

http://localhost:3000/lib/logger.js

However when IMD attempts to resolve the imported module it cannot be found:

The module "http://localhost:3000/lib/logger" has not been loaded

If we specify .js extension as part of the import statement it breaks the tooling since original file has .ts extension.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions