In this reactjs tutorial, we will discuss how to fix an error, error TS1192: Module has no default export. The solution will fix the below type of error:
- error TS1192: Module has no default export
- error TS1192 module has no default export
- error ts1192 module ‘ http ‘ has no default export
- error ts1192 module moment has no default export
- error ts1192 module node_modules/moment/moment ‘ has no default export
- error TS1192: Module ‘A.module’ has no default export
- error TS1192: Module ‘ “D:/SPFx/CRUDReact1/node_modules/@types/react/index” ‘ has no default export.
error TS1192: Module has no default export
The error comes while developing a SharePoint framework crud operations using react application. When I run the below command:
gulp build
It displays an error like below:

When I checked the code in the .tsx file, I saw the code like below:
import React, { Component } from 'react';

This line was creating the issue.
Then I have modified the code like below:
import * as React from 'react';
export default class CRUDReact extends React.Component<IHelloWorldProps, IStates> {
The other way, you can also modify the code like below:
import { React, Component } from 'react';
If you will write the above code, the error will not appear.
You may like the following tutorials:
- React js form tutorial
- What is react js and react native
- Property welcome does not exist on type ‘JSX.IntrinsicElements’ in SPFx React
- cannot find module jquery spfx
- type ‘string’ is not assignable to type ‘number’.ts
- Error TS2307 Cannot find module @pnp/sp/presets/all in SPFx
- office-ui-fabric-react combobox example in SharePoint Framework
I hope this tutorial helps you to learn how to fix error, error TS1192: Module has no default export.
I am Bijay a Microsoft MVP (8 times –Â My MVP Profile) in SharePoint and have more than 15 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com