Typescript compiler is forgetting to add file extensions to ES6 module imports?

后端 未结 2 1108
遇见更好的自我
遇见更好的自我 2021-01-01 16:09

I am trying to compile a Typescript project to JS with ES6 module resolution, but something seems not right.

My tsconfig.json looks like this:



        
2条回答
  •  误落风尘
    2021-01-01 16:44

    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.

提交回复
热议问题