Typescript compiler is forgetting to add file extensions to ES6 module imports?
This is a bug in TypeScript.
In the short term you can work around it by specifying the output file:
in main.ts
specify the .js
extension and path:
import { testText } from './module1.js';
alert(testText);
This will pick up module.ts
correctly, but output with the .js
extension included.
Note that you also need to prefix local files with ./
as 'bare' module names are reserved for future use.
Keith answered it correctly.
In your main.ts
instead of
import { testText } from 'module1';
try the following
import { testText } from 'module1.js';
In my case vscode intellisense works + I get the desired output file main.js as well.