Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error TS1192: Module '" A.module"' has no default export

I have created a new module 'A' and trying to import it in another module called 'B'. I am getting this error on compiling that says

error TS1192: Module '" A.module"' has no default export

Can anyone please help on how to solve this error.

like image 819
Abhi Avatar asked Nov 04 '16 18:11

Abhi


People also ask

Has no default export error?

The "Module has no default export" error occurs when we try to import as default from a module that doesn't have a default export. To solve the error make sure the module has a named export and wrap the import in curly braces, e.g. import {myFunction} from './myModule' .

What is default export in Javascript?

Export Default is used to export only one value from a file which can be a class, function, or object. The default export can be imported with any name.

Can only be default imported using the esModuleInterop Flagts 1259?

The error "Module can only be default-imported using esModuleInterop flag" occurs when we try to import a CommonJS module into an ES6 module. To solve the error, set the esModuleInterop option to true in your tsconfig. json file.

Has no exported member Did you mean to use?

The error "Module has no exported member" occurs when we try to import a member that doesn't exist in the specified module. To solve the error, make sure the module exports the specific member and you haven't mistyped the name or mistaken named for default import. Copied!


1 Answers

This was a simple error. It occurred due to the missing {} around the module name in the import statement itself. Since this killed 2-3 hours of my time, sharing with you all so you won't waste yours. Hope this can help someone. Cheers, Abhi.

like image 139
Abhi Avatar answered Sep 20 '22 15:09

Abhi