close

[Solved] Typescript es6 import module “File is not a module error”

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error Typescript es6 import module “File is not a module error” in javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How Typescript es6 import module “File is not a module error” Error Occurs?

Today I get the following error Typescript es6 import module “File is not a module error” in javascript.

How To Solve Typescript es6 import module “File is not a module error” Error ?

  1. How To Solve Typescript es6 import module “File is not a module error” Error ?

    To Solve Typescript es6 import module “File is not a module error” Error Above answers are correct. But just in case… Got same error in VS Code. Had to re-save/recompile file that was throwing error.

  2. Typescript es6 import module “File is not a module error”

    To Solve Typescript es6 import module “File is not a module error” Error Above answers are correct. But just in case… Got same error in VS Code. Had to re-save/recompile file that was throwing error.

Solution 1

Above answers are correct. But just in case… Got same error in VS Code. Had to re-save/recompile file that was throwing error.

Solution 2

In addition to Tim’s answer, this issue occurred for me when I was splitting up a refactoring a file, splitting it up into their own files.

VSCode, for some reason, indented parts of my [class] code, which caused this issue. This was hard to notice at first, but after I realised the code was indented, I formatted the code and the issue disappeared.

for example, everything after the first line of the Class definition was auto-indented during the paste.

export class MyClass extends Something<string> {
    public blah: string = null;

    constructor() { ... }
  }

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment