refinedev / refine

A React Framework for building internal tools, admin panels, dashboards & B2B apps with unmatched flexibility.
https://refine.dev
MIT License
25.92k stars 1.96k forks source link

[BUG] - Serialized Error: { code: 'ERR_UNSUPPORTED_DIR_IMPORT' } #6086

Open Gbolade-True opened 3 days ago

Gbolade-True commented 3 days ago

Describe the bug

Directory import `node_modules/@mui/material/Box` is not supported resolving ES modules imported from `node_modules/@refinedev/mui/dist/index.mjs`.

After extensive research, I found out that Node.JS doesn't support Directory imports. At least not yet. This is an issue with the latest release of the @refinedev/mui library. It imports Material UI components via directories.

This error was noticed when running tests using vitest in my application.

Steps To Reproduce

  1. Setup a basic React application with Vite and install latest release of necessary dependencies for refine:
    "@refinedev/core": "^4.51.0",
    "@refinedev/mui": "^5.17.0",
  2. Setup standard configurations for vitest after installing vitest , @testing-library/dom, @testing-library/jest-dom, @testing-library/react, and @vitejs/plugin-react.
  3. Create a basic test file. App.test.tsx
  4. Run vitest and see the error in the terminal.

Expected behavior

I expected the tests to run properly. If there were no Directory imports in the node_modules/@refinedev/mui/dist/index.mjs file, there wouldn't have been an issue. A minor fix to move from directory imports to file imports will be good and following the standards set by Node.JS

Packages

"@refinedev/core": "^4.51.0", "@refinedev/mui": "^5.17.0", "@refinedev/react-hook-form": "^4.8.20", "@refinedev/react-router-v6": "^4.5.11",

Additional Context

No response