Hi @wojtekmaj I am having an issue with react-date-picker where it is unable to resolve the react-calendar module. I don't know why it is happening. This is the first time I am facing this kind of issue.
Here is the complete error report:
React: 15.6
react-date-picker: 6.7.0
Error reported by webpack:
ERROR in ./node_modules/react-date-picker/dist/shared/locales.js
[0] Module not found: Error: Can't resolve 'react-calendar/dist/shared/locales' in '/home/modestreet/modestreet-repo/webUI/node_modules/react-date-picker/dist/shared'
[0] @ ./node_modules/react-date-picker/dist/shared/locales.js 7:15-60
[0] @ ./node_modules/react-date-picker/dist/DateInput.js
[0] @ ./node_modules/react-date-picker/dist/DatePicker.js
[0] @ ./node_modules/react-date-picker/dist/entry.js
[0] @ ./src/components/addEditInfo/AddEditInfo.js
[0] @ ./src/components/setupModule/SetupModule.js
[0] @ ./src/components/index.js
[0] @ ./src/services/routes.js
[0] @ ./src/components/modeStreetRouter/modeStreetRouter.js
[0] @ ./src/app.js
[0] @ ./index.js
I found a similar issue related to this but it was closed due to inactivity. Although I have commented there as well. See https://github.com/wojtekmaj/react-date-picker/issues/11#issuecomment-420168268. Feel free to close this incase you decided to reopen that one.
Thanks
Hey there,
users stuck on older versions of React are using React-Date-Picker version which are also not supported well.
My official workaround would be to use Yarn selective dependency resolutions to force React-Calendar to be a fixed version of 2.11.0.
@wojtekmaj On further debugging I found that react-date-picker has a dev dependency on react-calendar but I don't know why it is not making its node_modules folder for that dependency and since my webpack might be configured to resolve dependency in that particular manner it is not able to find that
@wojtekmaj I don't want to annoy you but I don't want to install yarn for fixing this dependency resolution. Is there another work around :slightly_smiling_face:
You could add "react-calendar": "2.11.0" (mind the lack of ^) to your package.json and hopefully npm will dedupe it and won't install two versions of react-calendar.
@wojtekmaj thanks mate! :smile: You saved me a lot of time. Although I have some other calendar errors that might be because of invalid props I might be passing, but webpack has complied successfully. :+1:
Feel free to close this.
@wojtekmaj one more thing can you improve your library documentation a bit. Can you just add some more sample examples, that would help me a lot and I have starred your repos. too.
That's a great idea :) I'll add something like "Recipes" soon. :)
Most helpful comment
You could add
"react-calendar": "2.11.0"(mind the lack of^) to yourpackage.jsonand hopefully npm will dedupe it and won't install two versions of react-calendar.