-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[BUG] - Serialized Error: { code: 'ERR_UNSUPPORTED_DIR_IMPORT' } #6086
Comments
Same issue here |
1 similar comment
Same issue here |
Sorry for the issue everyone! This is related with the Material UI's ESM builds and their publishing methods. Check out the issue from Material UI mui/material-ui#30671 We can update all our usage in Currently, due to issues in Material UI some bundler fail to interpret Material UI imports as ESM. This is not actionable on our side until there are any progress on Material UI side. 🙏 As a workaround for vitest, inlining the // vite.config.ts
/// <reference types="vitest" />
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
export default defineConfig({
plugins: [react()],
test: {
environment: "jsdom",
setupFiles: ["./vitest-setup.js"],
+ server: {
+ deps: {
+ inline: ["@refinedev/mui"]
+ }
+ }
}
}); We'll update this issue when we have any progress 🙏 |
Thanks @aliemir for the workaround ! |
Thanks, @aliemir !! Great work💯🫡 |
Describe the bug
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
vitest
,@testing-library/dom
,@testing-library/jest-dom
,@testing-library/react
, and@vitejs/plugin-react
.App.test.tsx
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.JSPackages
"@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
The text was updated successfully, but these errors were encountered: