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.
What do you think about automatically adding
.jsextension 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:
After transpiling it turns into an AMD module:
The module itself is loaded as part of an HTML Import:
And registered within the module registry with following name:
However when IMD attempts to resolve the imported module it cannot be found:
If we specify
.jsextension as part of the import statement it breaks the tooling since original file has.tsextension.