'Can't import the named export 'XXX' (imported as 'XXX') from default-exporting module (only default export is available)

I'm having an issue importing this in my TypeScript React project.

import { SwapWidget } from '@uniswap/widgets';

Getting this error on compilation yarn build:

Can't import the named export 'SwapWidget' (imported as 'SwapWidget') from default-exporting module (only default export is available)

This is the declaration in the @uniswap\widgets library:

declare type SwapWidgetProps = SwapProps & WidgetProps;
declare function SwapWidget(props: SwapWidgetProps): JSX.Element;

export { SUPPORTED_LOCALES, SwapWidget };

ts-config.js:

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx"
  },
  "include": [
    "src"
  ]
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source