Closed sep2 closed 2 years ago
I found a solution .yarnrc.yml
:
yarnPath: .yarn/releases/yarn-3.1.1.cjs
nodeLinker: pnp
packageExtensions:
"@mui/x-data-grid-pro@*":
dependencies:
"react-dom": "*"
"@mui/base": "latest"
"@mui/system": "*"
"@mui/styled-engine@*":
dependencies:
"@emotion/styled": "*"
"@emotion/react": "*"
But this is a hack, and should be resolved in the package itself. (the non-pro version is just working fine without this hack)
Looks like @mui/base
has to be added to peerDependencies for vite
compatibility.
I'll try to reproduce it in StackBlitz.
I'm probably the faulty one here
I imported something directly from @mui/base
in GridGroupingCriteriaCell
, we should always import from @mui/material
.
And probably block some imports with ESLint
Just in case - here's a reproduction repo https://github.com/cherniavskii/data-grid-pro-yarn-pnp-example
@flaviendelangle I can open a PR
@cherniavskii thanks !
Could you remove all the imports to @mui/base
, even in @mui/x-data-generator
?
@flaviendelangle Sure
I should mention that the part
"@mui/styled-engine@*":
dependencies:
"@emotion/styled": "*"
"@emotion/react": "*"
is used to resolved a similar problem for @mui/lab
.
Could you remove all the imports to @mui/base, even in @mui/x-data-grid-generator ?
@flaviendelangle Why to remove the imports to @mui/base
in @mui/x-data-grid-generator
? It's listed as dependency in package.json. It's only used in one place sure but the alternative without it is to duplicate the types in https://github.com/mui/mui-x/pull/3901/files#diff-845da0272d8d52f7bee961db66ca4f4d76f702f1c13f630d61dbd111fa781aeaR45 which could hide a bug if the core changes the params.
OK "all" may have been a strong statement.
I meant all the import { unstable_composeClasses as composeClasses } from '@mui/base';
since we are sometime importing it from @mui/material
and sometime from @mui/base
+1
I am seeing the same issue now using yarn2 pnp after upgrading to "@mui/x-data-grid-pro": "^5.5.0"
today.
"Module not found: @mui/x-data-grid-pro tried to access @mui/base, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound."
I applied the same patch that @sep2 mentioned above, but wanted to report.
dependencies:
"react-dom": "*"
"@mui/base": "latest"
"@mui/system": "*"
is used to resolved a similar problem for @mui/lab.
@sep2 The issue was eventually open: https://github.com/mui/material-ui/issues/32620 and fixed.
But this is a hack, and should be resolved in the package itself. (the non-pro version is just working fine without this hack)
Could you check again with the latest versions?
Duplicates
Latest version
Current behavior 😯
In yarn2 pnp mode with
vite
, the following error happened after installing"@mui/x-data-grid-pro": "^5.5.0"
. However the non-pro ("@mui/x-data-grid": "^5.5.0"
) version is just working fine.Expected behavior 🤔
Should work as before, no error throwed.
Steps to reproduce 🕹
Steps:
.yarnrc.yml
:@mui/material
and use it withvite
, everything is fine.@mui/x-data-grid-pro
and set the license info.yarn dev
/yarn build
, the error is throwed.Context 🔦
Only occured in Pro version.
Your environment 🌎
`npx @mui/envinfo`
Using Chrome Version 98.0.4758.80 (Official Build) (64-bit). ``` System: OS: Linux 5.16 Arch Linux Binaries: Node: 17.3.0 - /usr/bin/node Yarn: 3.1.1 - /usr/bin/yarn npm: Not Found Browsers: Chrome: Not Found Firefox: 96.0.3 ```Order ID 💳 (optional)
35352