fivecar / react-native-draglist

FlatList that can be reordered by dragging its items
MIT License
119 stars 19 forks source link

This package itself specifies a main module field that could not be resolved #1

Closed liquidvisual closed 1 year ago

liquidvisual commented 1 year ago

I'm getting the following import error when trying to run the sample code in my project. I'm not sure how to solve it:

Error: InternalError Metro has encountered an error: 
While trying to resolve module `react-native-draglist` from file `/Users/user/Desktop/my_app/src/components/UI/Drawer/DrawerTest.jsx`,
 the package `/Users/user/Desktop/my_app/node_modules/react-native-draglist/package.json` was successfully found. 
However, this package itself specifies a `main` module field that could not be resolved (`/Users/user/Desktop/my_app/node_modules/react-native-draglist/src/index.tsx`.

My setup:

"react": "17.0.2",
"react-native": "0.67.5",

My metro.config.js:

module.exports = {
  resolver: {
    sourceExts: [
      "cjs",
      "js",
      "json",
      "jsx",
      "mjs",
      "ts",
      "tsx",
    ],
  },
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: true,
      },
    }),
  },
};
fivecar commented 1 year ago

Thanks for reporting this, @liquidvisual. I'm still a bit new to how to package things so that everyone's import method works. With commit 26f2ae7d9b7f, I've updated the way that the package is bundled and distributed.

Would you mind trying release 1.1.0, authored in attempt to fix this? Thank you for your help!

fivecar commented 1 year ago

@liquidvisual : just wanted to check in on whether the new packaging has fixed the problem you discovered. Would you mind letting me know if it works for you now?

liquidvisual commented 1 year ago

@fivecar Hi! Sorry about the delay - I don't have my React Native project setup using this library anymore. I'll rollback to a previous version this weekend and give it another test - will get back to you. Thanks heaps for getting back. 👍

fivecar commented 1 year ago

@liquidvisual : no worries at all! Please don't inconvenience yourself with rollbacks/etc; I really appreciate you reporting the issue, and don't want to cause you more work!

fivecar commented 1 year ago

I believe this is now fixed, especially since others have integrated the package successfully. Please reopen if it continues to be an issue! Thank you!