stephy / CalendarPicker

CalendarPicker Component for React Native
802 stars 372 forks source link

Module not found: Error: [CaseSensitivePathsPlugin] when processed by webpack #170

Closed carlost closed 4 years ago

carlost commented 4 years ago

using:

Application uses react-native-calendar-picker with react-native. It also includess a web front end using react-native-web. Webpack throws the follow error when generating the bundle for the web front end:

13:42:30 client.1  | Module not found: Error: [CaseSensitivePathsPlugin] `/Users/<removed_to_protect_the_innocent>/client/node_modules/react-native-calendar-picker/CalendarPicker.gif` does not match the corresponding path on disk `calendarPicker.gif`.
13:42:30 client.1  |  @ ./client/src/components/DiditDatepicker.js 1:1379-1418
13:42:30 client.1  |  @ ./client/src/components/EventManagement/CreateEvent.tablet.js
13:42:30 client.1  |  @ ./client/src/components/EventManagement/index.js
13:42:30 client.1  |  @ ./client/src/screens/TabsScreen/Tabs/EMScreen.js
13:42:30 client.1  |  @ ./client/src/screens/TabsScreen/index.js
13:42:30 client.1  |  @ ./client/src/screens/HomeScreen.js
13:42:30 client.1  |  @ ./client/src/screens/AppNavigator.js
13:42:30 client.1  |  @ ./client/src/app.js
13:42:30 client.1  |  @ ./client/src/index.js
13:42:30 client.1  |  @ ./client/index.react_on_rails.js
13:42:30 client.1  |  @ multi (webpack)-dev-server/client?http://localhost:3035 webpack/hot/dev-server babel-polyfill ./client/index.react_on_rails.js
13:42:30 client.1  | webpack: Failed to compile.

react-native-web relies on webpack to generate the bundle for the web front end. On a case-insensitive file system webpack uses CaseSensitivePathsPlugin to keep build behavior consistent with case sensitive file systems.

The import causing the error is:

import CalendarPicker from 'react-native-calendar-picker';

The package.json in react-native-calendar-picker lists "./CalendarPicker" as "main". Instead of keeping the build behavior consistent, the CaseSensitivePathsPlugin attempts to load up the calendarPicker.gif in the root of the react-native-calendar-picker package instead of the CalendarPicker dir in the package root.

I am going to open an issue with CaseSensitivePathsPlugin and I understand that this is a bit of an edge case (APFS react-native-web etc.), but I think a small change would resolve this issue when using react-native-calendar-picker.

The calendarPicker.gif image does not appear to be referenced by react-native-calendar-picker. If this is correct, removing this file would resolve this issue. If the file is actually still being used, moving it to the assets directory would also resolve this issue.

If you are ok with (re)moving calendarPicker.gif I will be happy to open up a PR for you.

peacechen commented 4 years ago

Thanks @carlost for reporting this. It looks like calendarPicker.gif was superceded by the demo GIFs under assets/, so it should be safe to remove. Please submit a PR and I'll merge straight away.

peacechen commented 4 years ago

This has been removed in commit 158ce218e577c82b588a7c5e0a11b8c7f3781c24.