-
-
Notifications
You must be signed in to change notification settings - Fork 696
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
unpkg usage throwing react type is invalid error #981
Comments
May I suggest to use import to get the DayPicker. |
I have been using the import method until last week, My original issue is when I started to bundle When I run the project using the component library which uses |
I'm currently using it in a rollup based component library. Is it possible to share those errors? On the other hand, it does indeed seem that react-day-picker isn't exported correctly on the window when using it as and esm package. |
This is the error I get
In the render function I have a used DayPickerInput using the wrapper component from my component library. which imports Here is the render function of the library wrapper component
In my component library rollup config, I have these plugins and commonjs with namedExports
Do I have to do any namedExports for If possible can you share a snippet of your plugins in rollup.config.js |
I just tried to use just a simple DayPicker example from http://react-day-picker.js.org/docs/getting-started like this |
Getting this error as well when trying to import
Using rollup (with typescript & commonjs plugin)... |
could you add which version you are using? I tried with 7.4.0 and it seems to be working. My commonjs looks like this: No named exports. Also using the import statement in your example, it just works: There is still a problem with the esm package though. |
@KyorCode using v7.4.0 as well. |
@KyorCode Both the sandbox code has issues and does not work. Also tried using your commonjs configuration, I get the below error,
So after little digging removed
FYI, in all the above attempts my component library runs fine with expected output, the issue occurs only when I use the wrapped component from my component library inside the actual project. |
@KyorCode I think its similar but different in many ways, I tried v7.3.0 and i still have the same issue. |
@ShyamRaj could you post your wrapped component? Im starting to think the problem occurs there instead of the library. |
I have the exact same issue.
already causes it. my rollup config looks like this
i also tried removing the exlusion of "node_modules" from babel and add inclusion to commonjs but didnt work either |
I am having the same issue as @drbeat . I am also using inside of a component library using rollup to package everything up. |
Has anyone found a workaround yet? I have the same (see @coreybrown89 and @drbeat) issue concerning the bundle produced by Rollup. |
|
I am having the same issue, when I wrap up the DatePickerInput & produce ES module by Rollup. |
The issue seems to be with the export of this component, I'm not sure there's a way to trick rollup into building it into something it's not. If the author could export default like he did with in 'index.d.ts' add:
in your consumer component:
|
This is a nice workaround |
I had this issue on version 7.4.10, and I had to downgrade to react-day-picker version 7.4.8 and it worked. |
Closing as we've released v8: this issue belongs to a version which is not longer maintained, and it is likely fixed. In case, please open a new issue. Thanks! |
Describe the bug
When I try to use react-day-picker I get the follow errors in my console
To Reproduce
I can reproduce the error in the sandbox here -https://codesandbox.io/s/react-day-picker-base-vt99v
Expected behavior
Should be able to use the react-day-picker normally
The text was updated successfully, but these errors were encountered: