themesberg / flowbite-react

Official React components built for Flowbite and Tailwind CSS
https://flowbite-react.com
MIT License
1.77k stars 395 forks source link

Module '"flowbite-react"' has no exported member 'Flowbite'. #1327

Closed lyleunderwood closed 3 months ago

lyleunderwood commented 3 months ago

Steps to reproduce

  1. Upgrade to 0.7.6
  2. Check type errors

Current behavior

Typescript type exports seem busted in 0.7.6

Expected behavior

No errors, like in 0.7.5

Context

I have an up-to-date nextjs / typescript project using flowbite-react, and upon upgrading to 0.7.6, all of my imports started having typescript errors. Some examples:

src/components/ThemeProvider.tsx:3:26 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("flowbite-react")' call instead.
  To convert this file to an ECMAScript module, add the field `"type": "module"` to '/home/lyle/dev/showlabs/morpheus-frontend/package.json'.

3 import { Flowbite } from 'flowbite-react';
src/components/ThemeProvider.tsx:3:10 - error TS2305: Module '"flowbite-react"' has no exported member 'Flowbite'.

3 import { Flowbite } from 'flowbite-react';
src/components/SearchInput.tsx:4:10 - error TS2305: Module '"flowbite-react"' has no exported member 'TextInput'.

4 import { TextInput } from 'flowbite-react';

I'm pretty sure that every single import from flowbite-react errors. Rolling back to 0.7.5 resolves the issue. I assume this is related to the monorepo transition in 0.7.6.

SutuSebastian commented 3 months ago

I have an idea what could be wrong. I'll be back with more info.

rluders commented 3 months ago

Probably related/connected to #1329 1329

SutuSebastian commented 3 months ago

Check 0.7.8, hope it fixed everything related to imports/build/install.

lyleunderwood commented 3 months ago

I had some auto-import references like:

import { Button } from 'flowbite-react/lib/esm/components/Button';

which no longer resolved in 0.7.8, just had to update them and now everything seems to work fine :+1: