jacobworrel / react-windowed-select

An integration of react-window with react-select to efficiently render large lists.
MIT License
142 stars 38 forks source link

Minified react error #130 when building with vite #114

Closed hugorplobo closed 11 months ago

hugorplobo commented 1 year ago

Hi, when I run vite build in my project I get this error (it doesn't happen in the development mode)

image

I tried to comment all the components in my application and I'm sure that the WindowedSelect is causing the error, but I don't know why. The project is here and you can see the error in production build here

Any idea in how to solve it?

RobMaple commented 1 year ago

I've just run into the same issue myself. I think the issue is to do with rollup's (which vite uses for production builds) handling of wildcard exports. In this case, I think it seems to have an issue with how react-windowed-select re-exports react-select's components:

export * from 'react-select';

I think I've managed to work around this by importing just the WindowedMenuList component from react-windowed-select and passing it to a normally imported react-select component:

import {WindowedMenuList} from "react-windowed-select";
import Select from "react-select";

...

<Select
    components={ { MenuList: WindowedMenuList }}
    {...props}
/>

The only issue I can see with this is that it missies out on some additional logic that using the full react-windowed-select component provides to determine weather to window the menulist or render the default one for smaller lists.

jacobworrel commented 11 months ago

fix published in 5.1.1