vtaits / react-select-async-paginate

Wrapper above react-select that supports pagination on menu scroll
MIT License
303 stars 75 forks source link

Uncaught TypeError: (0 , import_compose_react_refs.default) is not a function #134

Closed mihkeleidast closed 1 year ago

mihkeleidast commented 1 year ago

Are you submitting a bug report or a feature request or a question?

A bug report.

What is the current behavior?

After updating from 0.7.0 to 0.7.1, a component using this library fails to render with an error:

Uncaught TypeError: (0 , import_compose_react_refs.default) is not a function

The error happens on this line here: https://github.com/vtaits/react-select-async-paginate/blob/master/packages/react-select-async-paginate/src/wrapMenuList.tsx#L100

What is the expected behavior?

No errors when rendering.

Sandbox Link

I did not create a reproduction at the moment, can do so if it is necessary, but it's not very easy to create a minimal repro anyway.

What's your environment?

The error comes up in Storybook that is using vite as the bundler. Note that I could not reproduce the issue in this repository, which also uses storybook with vite, but that is probably because in this repo storybook loads the source files, not the build output.

{
  "react": "^18.2.0",
  "react-dom": "^18.2.0",
  "react-select": "^5.5.8",
  "react-select-async-paginate": "^0.7.1",
  "vite": "^3.1.8",
  "@storybook/react": "^6.5.13",
  "@storybook/builder-vite": "^0.2.5",
}

Other information

There seem to be differences in the build output from this commit, which is probably the root cause of the issue. I did not see any changes for the particular dependency nor the place where it is used.

vtaits commented 1 year ago

Hello. It turns out that webpack doesn't correctly handle all es-imports if file extension in .mjs.

Fixed in 0.7.2.

mihkeleidast commented 1 year ago

Thanks, the fix seems to work!