Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Element type is invalid: expected a string When using Webpack 5 #266

Closed
SamMorrowDrums opened this issue Jan 22, 2021 · 2 comments
Closed

Comments

@SamMorrowDrums
Copy link

My setup is with WebPack 5 and ES Modules.

When doing the following as per usual I now get a failure:

<Provider store={store}>
  <div>
    ... other things like router ...
    // props are not required
    <ReduxToastr
      timeOut={4000}
      newestOnTop={false}
      preventDuplicates
      position="top-left"
      getState={(state) => state.toastr} // This is the default
      transitionIn="fadeIn"
      transitionOut="fadeOut"
      progressBar
      closeOnToastrClick/>
  </div>
</Provider>

The cause it is that there is an object of various exports being imported, so I have had to do:

<ReduxToastr.default
  ...
/>

This issue only occurred when upgrading WebPack. I assume it's in part to do with changes to module resolution, but thought this might at least help others who have the same issue:

@diegoddox
Copy link
Owner

My apologies for not getting back to you, I'm closing but feel free to re-open in case you need it.

@SamMorrowDrums
Copy link
Author

@diegoddox no problem for me any longer. I'm not currently using it, however it might well be worth ensuring that things are exported correctly for Webpack 5 and native ES Modules, as I expect this will be a more popular use-case now than when I first tried.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants